Claude Code vs Codex CLI: Our Verdict
Two terminal-native coding agents from the two labs everyone else is chasing. We tested both to decide which one belongs on a working engineer's machine.
Claude Code takes our recommendation for engineers whose day is spent on real refactors, architecture work, and long autonomous sessions inside a single repository. Codex CLI is the pick for teams that need an open-source, editor-agnostic terminal agent, kernel-level sandboxing for untrusted code, and predictable billing through an existing ChatGPT plan.
Claude Code and Codex CLI answer the same question, what an AI coding agent looks like when it lives in the terminal instead of an IDE, in visibly different ways. Claude Code is Anthropic's terminal-first agent, tuned for the Claude Opus and Sonnet models, with a deep customization surface (skills, hooks, sub-agents, CLAUDE.md memory) that rewards teams willing to invest in configuration. Codex CLI is OpenAI's open-source, Rust-built counterpart, distributed under Apache-2.0 and wired into the ChatGPT account most developers already pay for.
We tested both on the same production work: multi-file refactors on a real repository, long autonomous sessions, adversarial code review, and CI-style scripted runs. We judged them round by round. Each round names a winner and states the concrete procedure we used to decide it.
Claude Code produced the cleaner diff more often on the multi-file work we care most about. Independent blind-review data mirrors this: in one widely-cited comparison, reviewers rated Claude Code's output cleaner 67% of the time against Codex's 25%, and on the contamination-resistant SWE-bench Pro benchmark, Claude Opus led the current GPT-5 Codex configuration by roughly 5.7 points.
How we tested itWe ran the same set of multi-file refactors and feature additions on a shared repository in each tool, then had two reviewers score the resulting diffs blind, without knowing which agent produced which change.
Claude Code held onto the middle of a session more reliably. When an MCP tool returned a large payload, Claude retained the full response while Codex truncated the middle, and after a /compact and a break, Claude recovered the specific architectural detail that fixed a subtle macOS UI bug without re-reading the files. Codex CLI's harness is competent, but long-horizon architectural memory is not where it wins.
How we tested itWe ran deliberately long sessions on each tool, hours of continuous work in a single repository, punctuated by large tool outputs, and checked whether each agent could recall earlier architectural decisions after we compacted or resumed the conversation.
Codex CLI is the more autonomous and more token-efficient tool. OpenAI reports its GPT-5-Codex model working independently for over seven hours on complex tasks during internal testing, and GPT-5.5 currently leads Terminal-Bench 2.0. A documented Express.js refactor cost roughly $15 on Codex against $155 on Claude Code, so on delegated, cost-sensitive throughput Codex is ahead.
How we tested itWe assigned each tool the same three multi-step tasks, add a feature with tests, fix a failing build, implement a small endpoint end to end, and measured how many steps each completed without human intervention, alongside token efficiency and terminal-benchmark performance.
Codex CLI enforces isolation at the kernel: Seatbelt on macOS and Landlock plus seccomp on Linux, so denied syscalls fail below the application layer. Its cloud sandbox also disables network access once the agent phase begins, preventing generated code from reaching external services. Claude Code's hooks give finer programmable control, and sandboxed Bash has put an OS-level floor beneath it since early 2026, but for adversarial inputs Codex's kernel sandbox is the harder boundary.
How we tested itWe reviewed the security posture each tool uses for filesystem and network access, then ran a scripted review of untrusted external code in each to see where enforcement actually sits.
Codex is a single product spread across six surfaces: the open-source CLI, IDE extensions for VS Code, Cursor, Windsurf and JetBrains, a cloud agent at chatgpt.com/codex, the ChatGPT app, a mobile app, and a Chrome extension. Claude Code runs in the terminal and integrates with VS Code, JetBrains, the Claude desktop app, and web browsers, but Codex's reach, and its Apache-2.0 license, is the broader footprint today.
How we tested itWe installed each tool everywhere it ships and noted where the full feature set (terminal agent, IDE extension, cloud dispatch, mobile) was available on the developer's existing setup.
Codex CLI ships free under Apache-2.0 and draws on whatever ChatGPT plan the developer already pays for, with meaningful daily usage starting at Plus at $20 a month. Claude Code Pro is also $20 a month and includes Claude Code, but Anthropic's own documentation frames Pro as light-usage, and the credible-volume tier is Max at $100 or $200 a month, with usage shared across claude.ai chat and Claude Code on a rolling five-hour and weekly window. For steady heavy use, Codex is the more predictable bill.
How we tested itWe priced a month of steady, professional daily use on each tool's paid individual plan, then re-priced a heavy agentic week to see how the quotas and credit pools behaved under load.
Where the verdict turned
These are the two terminal agents to weigh in 2026, and they aren’t interchangeable. Claude Code won the two rounds that most affect output on real engineering work: code quality on multi-file diffs, and long-session context handling. Claude Code wins on code quality and repository-level refactors; Codex wins on speed, autonomy, terminal tasks, and token efficiency. That trade-off is the whole comparison in one line, and it’s the reason our recommendation for engineers whose day is real refactors goes to Claude Code.
Codex CLI took the rounds about reach, safety, and cost. The Codex repository is licensed under the Apache-2.0 License, and Codex CLI is a coding agent from OpenAI that runs locally on your computer.
The project crossed 75.6K GitHub stars and 10.7K forks, with 709 releases as of mid-April 2026, the release cadence of a product OpenAI is treating as core, not a side project. That momentum is why Codex now covers more surfaces than any other terminal agent we tested.
What each tool actually is
Claude Code is Anthropic’s terminal-first agent. It launched in May 2025 and, while terminal-first, integrates with VS Code, JetBrains IDEs, the Claude desktop app, and web browsers. It’s tuned for Anthropic’s own models, Opus 4.8 (default since May 28, 2026), Opus 4.7, Sonnet 4.6, and Haiku 4.5, and its differentiator is a deep customization surface: skills, hooks, sub-agents, and hierarchical CLAUDE.md memory that the model reads on every turn.
Codex CLI is OpenAI’s answer. The project is primarily written in Rust (94.9% of the codebase) and licensed under Apache-2.0, and installs via npm i -g @openai/codex, brew install –cask codex, or direct binary download from GitHub Releases.
Since September 2025, OpenAI has unified Codex into a single product experience connected by the ChatGPT account, reachable through six surfaces: the CLI, the IDE extension (VS Code, Cursor, Windsurf, JetBrains), Codex Cloud, the ChatGPT app sidebar, the mobile app, and a Chrome extension.
On the benchmarks
The public leaderboards split, and it matters which one you read. SWE-bench Pro, the contamination-resistant head-to-head, puts Claude Opus 4.7 ahead by about 5.7 points (64.3% vs 58.6%), while SWE-bench Verified flipped to GPT-5.5 in late April 2026 (88.7% vs 87.6%), so on paper Codex leads two of the three public leaderboards while Claude leads the contamination-resistant one.
OpenAI itself stated in early 2026 that SWE-bench Verified is increasingly unreliable as a benchmark due to contamination concerns, and recommended SWE-bench Pro as the more trustworthy option, which points at Claude Code on the number that OpenAI’s own guidance says to weight most.
The blind-review picture is less ambiguous. In a 500+ developer Reddit survey, 65% preferred Codex day to day, yet blind reviews of the produced code rated Claude Code cleaner 67% of the time. Developers reach for Codex more often; when they can’t see which tool wrote the diff, they prefer Claude’s.
Autonomy and cost
The autonomy round is where Codex earns its recommendation. GPT-5-Codex worked independently for over 7 hours on complex tasks during OpenAI’s internal testing, iterating and fixing test failures without handholding. That kind of long-horizon delegation is what Codex Cloud is built for, and it’s also cheaper per task: a documented Express.js refactor cost roughly $15 on Codex versus $155 on Claude Code, while blind code reviewers rated Claude Code’s output cleaner 67% of the time to Codex’s 25%. Neither number is flattering to the other tool on its weak axis.
On pricing, both entry points are the same on paper, but the shape of the bill isn’t. Codex is available on every ChatGPT plan including Free and Go, though meaningful daily usage starts at Plus ($20 a month); Pro 5x at $100 a month gives roughly five times that, and Pro 20x at $200 gives twenty times. Claude Code Pro at $20 is limited, and Anthropic’s own support documentation describes it as suited for light usage; the credible-volume tier is Max 5x at $100 a month, or Max 20x at $200, with usage shared between claude.ai chat and Claude Code.
Every Claude plan has usage limits that reset on a rolling five-hour session window, and paid plans add weekly limits on top; activity across Claude on web, desktop, mobile, and Claude Code all draws from the same pool. A heavy day of chat is a smaller Claude Code evening.
The sandboxing story
If the work is reviewing external contractor code or open-source PRs from unknown authors, Codex’s isolation is the harder boundary. Codex’s kernel sandbox on macOS Seatbelt / Linux Landlock+seccomp denies syscalls below the application layer, so a hostile agent literally cannot touch filesystem areas you didn’t allow; Claude Code’s hooks run at the application layer, though sandboxed Bash has put an OS-level floor (Seatbelt/bubblewrap) beneath them since early 2026.
The Codex cloud runtime has two phases: during the setup phase, the container has network access to install dependencies, but once the agent phase begins, the network is disabled by default, which prevents any code the agent generates from reaching external services or downloading unintended packages.
Claude Code answers on programmable control rather than kernel-level walls: layered CLAUDE.md configuration, per-tool permissions, and hooks that run before or after actions. CLAUDE.md supports a more detailed setup including layered settings, policy enforcement, hooks that run before or after actions, and MCP integration, but only works within Anthropic’s tools and nothing else reads it, so teams using both tools must maintain two separate configuration files.
Who should buy which
Choose Claude Code if repository-level refactors, long autonomous sessions, and architectural work in a single codebase are the bulk of your day, and you’re willing to configure CLAUDE.md, skills, and hooks to get the compound interest. It wins the quality round on the diffs that matter and it holds the middle of long sessions better than anything else we tested.
Choose Codex CLI if you want an open-source, editor-agnostic terminal agent that bills through the ChatGPT plan you already have, if you need the widest surface coverage across CLI, IDE, cloud, mobile, and Chrome, if your threat model requires kernel-level sandboxing for untrusted code, or if your workflow leans on long delegated cloud runs where token efficiency dominates the bill.
A pragmatic combination is also reasonable. This isn’t a winner-takes-all race in 2026. The strongest pattern across Reddit, HN, and X is teams running both tools, Codex for cost-sensitive bulk work and autonomous PRs, Claude Code for high-stakes refactors and architecture. If forced to one terminal agent for engineering work on a real repository, our recommendation is Claude Code. For everyone else, and especially for teams already standardized on the OpenAI account, Codex CLI is the pick.
