Official A.I Ranking
Head-to-Head · Coding Assistants

Claude Code vs OpenAI Codex CLI: Our Verdict

Two terminal-native coding agents from the two frontier labs. We ran both on the same production work to decide which one most working engineers should default to.

By Theodore Pruitt, Senior Reviewer, Assistants & Code June 8, 2026 6 rounds judged
Claude Code
Anthropic
2 rounds won
vs
OpenAI Codex CLI
OpenAI
4 rounds won
The Verdict Winner: Claude Code Claude Code

Claude Code wins on first-pass code quality, long-context reasoning, and programmable governance, and takes our recommendation as the default terminal agent for working engineers. Codex CLI is the right pick for teams that need open-source tooling, kernel-level sandboxing for untrusted code, or the cheaper per-task bill on high-throughput autonomous work.

Both tools answer the same question, what should a coding agent that lives in your terminal feel like, and answer it differently. Claude Code is Anthropic's closed-source CLI, runs locally, and leans into deep reasoning with the Opus line, paired with an application-layer governance system built around lifecycle hooks. Codex CLI is OpenAI's open-source, Rust-based agent that defaults to sandboxed execution at the OS kernel layer and optimizes for throughput, token efficiency, and cross-tool portability through the AGENTS.md standard.

We ran both on the same production work: multi-file refactors, bug fixes with failing tests, long investigations across unfamiliar code, and bulk autonomous PRs. We judged them round by round. Each round names a winner and states the procedure we used to decide it. Both tools ship roughly weekly, so the facts here have a shelf life; we noted model versions and dates where they mattered.

The Rounds
First-Pass Code Quality
Round toClaude Code

Claude Code's diffs were judged cleaner and more idiomatic in the majority of pairs, and that matches the broader signal: in blind evaluations elsewhere, developers rated Claude Code's output cleaner than Codex CLI's 67% of the time against 25%. The gap is largest on frontend work, where Codex CLI's React output drew the most complaints in our review.

How we tested itWe gave each tool the same set of feature additions and bug fixes across a TypeScript web app and a Python service, then had two reviewers blind-score the produced diffs for clarity, idiomatic style, and adherence to the surrounding code's conventions, without knowing which tool produced which diff.

Multi-File Refactoring & Long Context
Round toClaude Code

Claude Code on Opus 4.8 reached an acceptable multi-file diff in fewer attempts on every refactor we ran, and its 1M-token context window at standard pricing meant it could hold the relevant call sites in memory without aggressive compaction. Codex CLI on GPT-5.5 defaults to a 400K context in the CLI and bills long-context sessions at a 2×/1.5× multiplier above 272K input tokens, which made the same work both slower and more expensive on the harder refactors.

How we tested itWe ran the same five real refactors on a mid-sized repository (renaming an interface across files, lifting a shared component, updating an API contract, extracting strings to i18n keys, and changing a widely-used type) and counted the attempts needed to land an acceptable diff in each tool.

Terminal-Native & Agentic Work
Round toOpenAI Codex CLI

Codex CLI on GPT-5.5 is at the state of the art on Terminal-Bench 2.0 at 82.7%, and that lead showed up in our runs: it completed terminal-native tasks more reliably and ran longer autonomous sequences without asking for help. Its Cloud mode and best-of-N attempts on a single task make it the better tool when the work is bulk and the human review happens at the end, not in the loop.

How we tested itWe assigned each tool the same scripting, system-administration, and CI-style tasks that benchmarks like Terminal-Bench 2.0 are designed to probe, plus three autonomous PRs from a single product spec, and recorded both completion rate and whether the agent had to be re-prompted.

Sandboxing & Governance
Round toOpenAI Codex CLI

Codex CLI enforces isolation at the OS kernel layer (Seatbelt on macOS, Landlock and seccomp on Linux), which is the stronger boundary when the code or the model can't be fully trusted. Claude Code enforces governance at the application layer through more than two dozen programmable lifecycle hook events: finer control for trusted code and organizational policy, weaker isolation against an agent trying to escape its box.

How we tested itWe reviewed how each tool actually enforces what the agent is allowed to do, where the boundary lives, how granular the control is, and what a security reviewer would have to trust, and ran each through the same untrusted-code review scenario.

Pricing & Cost per Task
Round toOpenAI Codex CLI

On token-for-token tasks Codex CLI consistently used roughly four times fewer tokens than Claude Code on the same work, and that ratio matters: on a heavy week the Codex bill was the one that did not need rationing. Anthropic also splits Claude billing into two pools as of June 15, 2026. Interactive Claude Code stays on your Pro/Max plan limits, but Agent SDK and programmatic use bills separately at full API list prices, which adds a budgeting wrinkle Codex users do not have to track.

How we tested itWe priced a month of normal use on each tool's individual paid plan, then re-priced a heavy week of agentic work (long sessions, multi-file changes, autonomous PRs) to see how the bills behaved in practice.

Ecosystem & Portability
Round toOpenAI Codex CLI

Codex CLI's AGENTS.md is an open standard governed by the Agentic AI Foundation under the Linux Foundation and is read by Codex, Cursor, GitHub Copilot, Amp, Windsurf, and Gemini CLI, with adoption across 60,000+ projects: a single file that travels with the repo. Claude Code's CLAUDE.md is mature and powerful, but it is Anthropic-specific; a team running mixed tooling has to maintain both.

How we tested itWe checked which instruction files, IDE surfaces, and CI integrations each tool ships with, and whether the same project configuration carries over to other agents a team might use alongside it.

Where the verdict turned

Claude Code took the two rounds that most affect the output a working engineer ships every day: first-pass code quality and multi-file refactoring. The blind-review signal is consistent across our tests and the wider community. Developers rate Claude Code’s diffs cleaner 67% of the time against Codex CLI’s 25%, with 8% ties, and the long-context behavior on Opus 4.8 means a complex refactor lands in fewer attempts. Fewer attempts means fewer debug cycles, and that is the case for the higher overall mark.

Codex CLI took the rounds about reach, isolation, and cost. It is at the state of the art on Terminal-Bench 2.0 at 82.7%, its kernel-layer sandboxing is the stronger boundary when the code under review cannot be trusted, and its token efficiency, roughly four times fewer tokens on the same work, keeps the bill predictable on heavy agentic weeks. The AGENTS.md standard makes it the lower-friction choice for a team that already runs mixed tooling.

What changed in the last month

Anyone choosing today is choosing across a moving target. Anthropic shipped Claude Opus 4.8 on May 28, 2026, which raised the bar Codex CLI had to clear on Claude’s side of the comparison and made the 1M-token context window the default at standard pricing on Max and Team tiers. OpenAI shipped GPT-5.5 on April 23, 2026, which gave Codex CLI its current Terminal-Bench 2.0 lead and narrowly took SWE-bench Verified as well. Codex also shipped a real lifecycle-hook system this spring, narrowing what used to be Claude Code’s clearest lead on programmable governance.

The pricing model is also shifting. From June 15, 2026, Anthropic splits Claude subscription billing into two pools: interactive Claude Code in the terminal and IDE continues to draw from your existing Pro or Max plan limits, while programmatic use (claude -p, the Agent SDK, the Claude Code GitHub Actions integration, and ACP-based third-party tools) moves to a separate monthly Agent SDK credit billed at full API list prices. If you script Claude Code into CI, budget against that new pool, not the plan limits you’re used to. OpenAI went the other way in early May and loosened Codex limits at the $100 tier in a promotion aimed at Claude Code switchers.

Who should buy which

Choose Claude Code if the bulk of your day is complex multi-file work on a codebase you already own, you value first-pass diffs you can trust, and you want the deepest programmable governance through CLAUDE.md, hooks, and skills. It’s the stronger tool for onboarding to unfamiliar code, for the kind of refactor where the dependency graph matters, and for engineers who would rather review a smaller, cleaner diff than a faster one.

Choose OpenAI Codex CLI if you need kernel-level isolation for untrusted code, if you run a lot of autonomous bulk PRs from a single specification, if your stack already standardizes on AGENTS.md, or if predictable cost on heavy weeks is the constraint. It’s the better tool for terminal-native scripting and DevOps work, for fire-and-forget tasks reviewed at the end, and for teams who want the open-source CLI and the cross-tool portability that comes with it.

A two-tool workflow is also reasonable, and it’s what most senior teams we spoke to actually run: Claude Code as the daily driver for design and surgical edits, Codex Cloud for bulk parallel PRs. The two CLIs do not conflict; the instruction files (CLAUDE.md and AGENTS.md) sit side by side in the repo. But if forced to one terminal agent, our recommendation for working engineers is Claude Code. For everyone else, and for any team that has to defend a security boundary or a budget, Codex CLI.

Sources