Coding

Codex vs Claude Code: A Side-by-Side Comparison

Codex vs Claude Code from the official docs: where each runs, plans and limits, models, AGENTS.md vs CLAUDE.md, sandboxing and extensions.

Robert Youssef14 min
Codex vs Claude Code: A Side-by-Side Comparison
On this page

Codex vs Claude Code comes down to three things you can check before installing either one: which plan you already pay for, how much the agent may do on your machine without asking, and where your team's instructions and tools already live. Both are coding agents that read a repository, edit files and run commands from a terminal, an editor, a desktop app or the cloud. Codex is OpenAI's agent and runs GPT models. Claude Code is Anthropic's and runs Claude models.

Everything below comes from Anthropic's and OpenAI's own documentation and pricing pages, checked on December 1, 2026, plus one public benchmark. Each section links to the pages its facts come from, so you can recheck them. Plans and model names in this category change from month to month.

Quick answer: which one to pick

Claude Code makes sense if you already pay for Claude Pro or a higher plan, since it's included and draws from the same usage pool as your chats. It also has the larger hook system on paper: 34 hook events against 14 in Codex, and five handler types against two.

Codex is the one to try if you want to start at $0. The ChatGPT Free plan includes Codex in the desktop app (subject to rollout), while the free Claude plan has no Claude Code at all. Codex also turns its OS sandbox on by default, including on native Windows, and its CLI is open source under Apache-2.0.

Already have an AGENTS.md in the repo? You can run both. Claude Code reads that file when the project has no CLAUDE.md, so one set of instructions serves two agents.

If Cursor is also on your list, our Claude Code vs Cursor comparison covers that pairing.

Codex and Claude Code at a glance

Claude Code Codex
Made by Anthropic OpenAI
Where it runs Terminal, VS Code (also installs in Cursor), JetBrains, desktop app, web, Claude app for iOS and Android CLI, IDE extension (VS Code, Cursor, Windsurf), Xcode and JetBrains integrations, ChatGPT desktop app, Codex Cloud, ChatGPT iOS app
Free plan Not included Desktop app with GPT-6 Luna, subject to rollout
Cheapest plan with the CLI Pro: $20 a month, or $17 a month billed annually Plus: $20 a month
Default model Opus 5.5 on Pro, Max, Ultra, Team, Enterprise and API Not named for the CLI; GPT-6.2 Astra and GPT-6.2 Sol recommended
Instruction file CLAUDE.md (reads AGENTS.md when there's no CLAUDE.md) AGENTS.md
Local OS sandbox Off by default; macOS, Linux, WSL2 On by default; macOS, Linux, WSL2, native Windows
Plan mode Shift+Tab or /plan /plan
Hook events 34 14
Cloud tasks Claude Code on the web Codex Cloud
Source code Proprietary ("All rights reserved") CLI open source, Apache-2.0

Sources for each row are in the sections below.

Where each one runs

Both agents cover the same five places (terminal, editor, desktop, browser, phone). The packaging is different.

Claude Code ships as a CLI for macOS, Linux, WSL and Windows, a VS Code extension that also installs in Cursor, and a JetBrains plugin that needs the CLI installed separately. The desktop app has a Code tab with Claude Code built in and requires a paid subscription. On the web it lives at claude.ai/code, where cloud sessions are available on Pro, Max, Ultra and Team plans and for some Enterprise seats. Anthropic says every surface connects to the same engine, so your CLAUDE.md files, settings and MCP servers carry over. You can also move a session: claude --teleport pulls a web task into your terminal, and /desktop hands a terminal session to the desktop app.

Codex installs as a CLI with a one-line script. The IDE extension covers VS Code, Cursor and Windsurf, while Xcode and JetBrains IDEs offer Codex through their own integrations. On the desktop, Codex sits inside the ChatGPT app next to Chat and Work. Codex Cloud runs each task in its own workspace that "can keep working while your computer is asleep." The ChatGPT mobile app on iOS can start cloud tasks or drive a Mac or Windows PC you've connected.

Diagram of where Codex and Claude Code run: terminal, IDE, desktop, web and cloud, mobile, and CI or chat
Surfaces listed in each product's documentation on December 1, 2026.

Outside the editor, both reach into CI and team chat. Claude Code has GitHub Actions and GitLab CI/CD, and on Team and Enterprise plans a Slack route through Claude Tag. Codex has the openai/codex-action@v1 GitHub Action, automatic pull request review, and an @ChatGPT mention in Slack that can hand repository work to Codex Cloud. For scripts, the headless commands are claude -p and codex exec.

Plans and usage limits

Here's what each company lists on its own pricing page, checked December 1, 2026. Claude's prices exclude tax.

Claude (claude.com/pricing):

Plan Price Claude Code Usage, as Anthropic describes it
Free $0 No Limited, every 5 hours and every week
Pro $20 a month, or $17 a month billed annually ($200 a year) Yes More than Free, every 5 hours and every week
Max $100 a month Yes 5x Pro, every 5 hours and every week
Ultra $200 a month Yes 10x Pro per week, no 5-hour limit for verified accounts
Team Standard $20 per seat ($25 monthly); Premium $100 per seat ($125 monthly) Yes Premium seats get 5x Standard
Enterprise $20 per seat plus usage at API rates, billed annually, 20-seat minimum Yes Scales with usage

Codex (learn.chatgpt.com/docs/pricing):

Plan Price What you get in Codex
Free $0 GPT-6 Luna in the desktop app, subject to rollout
Go $8 a month Same as Free
Plus $20 a month Web, CLI, IDE extension and iOS; code review and Slack
Pro From $100 a month ($100, $200 or $500) No five-hour limit at the moment; Ultrafast mode on the $500 plan
Business $20 per user billed annually, $25 monthly, 2+ users Larger cloud machines, admin controls
Enterprise and Edu Contact sales Flexible pricing with credits available
API key API rates CLI, SDK and IDE extension only, no cloud features

On Anthropic's side, Claude Code shares one pool with your chats on web, desktop and mobile. There's a rolling five-hour window, paid plans add a weekly limit, and the pricing page says there's "no fixed message count." Subagents send their own requests, and those count toward the same limits as the main conversation.

OpenAI does publish ranges, which it calls estimates and not fixed limits. For Plus, the estimates per five-hour period of local messages are 17 to 180 with GPT-6.2 Sol, 6 to 50 with GPT-6.2 Astra and 350 to 3,000 with GPT-6 Luna. Cloud tasks may use more, weekly limits may also apply, and the page notes that each MCP server adds context and uses more of your limit.

So at $20 the sticker price is identical. What differs is how much you know in advance: OpenAI gives a per-model range, Anthropic gives multipliers between plans. For a deeper breakdown on the Anthropic side, see our Claude Code pricing page.

Models behind each agent

Claude Code's default is Opus 5.5 on Pro, Max, Ultra, Team, Enterprise and the Anthropic API (it needs Claude Code v2.1.280 or later). You switch with /model or --model. The sonnet alias points to Sonnet 5.5 and haiku to Haiku 5.5. The fable alias selects Fable 5.2, Anthropic's top model, which no plan uses by default. On Pro it's paid with usage credits; Max and Ultra include it for up to half the weekly limit. There's also opusplan, which runs Opus while you're in plan mode and Sonnet once the work starts.

Codex recommends two models. GPT-6.2 Astra handles demanding work, like tracing a bug across services, and gets a default context of 272,000 tokens in Codex. GPT-6.2 Sol is the everyday one. It costs fewer credits per token than Astra and has a 500,000-token default context. Both are available on Plus, Pro, Business, Enterprise and Edu in the Codex app and CLI. GPT-6.1 Terra is the fast pick, and Free and Go accounts get GPT-6 Luna. To pick one in the CLI:

codex -m gpt-6.2-sol

OpenAI doesn't name a single default model for the Codex CLI. Its docs only say new Work chats start with GPT-6.2 Sol.

One practical gap: context size. Claude Code's model page notes that Opus 4.7 and later have a native 1M-token window, while Codex lists 272,000 and 500,000 tokens as defaults for its two recommended models. If you keep long sessions on a big codebase, that's a documented difference worth weighing.

Project instructions: CLAUDE.md and AGENTS.md

Codex reads AGENTS.md before it does anything. It starts with your global file in ~/.codex, then walks from the repository root down to your current folder, picking up an AGENTS.md (or an AGENTS.override.md) at each level. Files closer to where you are come later in the prompt, so they win. It stops adding files at 32 KiB by default, a cap you can raise with project_doc_max_bytes. Running /init writes a starter AGENTS.md.

Claude Code reads CLAUDE.md from the project root (or .claude/CLAUDE.md), your home folder and an optional CLAUDE.local.md you keep out of git. Anthropic suggests keeping each file under 200 lines and moving folder-specific rules into .claude/rules/. Since v2.1.277 it also reads AGENTS.md directly, but only when there's no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md in your working folder or above it. If both exist, Claude reads only CLAUDE.md unless you import the other file.

That import is the cleanest way to keep one source of truth for both agents. Here's an example layout:

<!-- AGENTS.md: read by Codex, and by Claude Code through the import below -->
## Repository expectations
- Run `npm run lint` before opening a pull request.
- Use pnpm to add dependencies.

<!-- CLAUDE.md -->
@AGENTS.md

## Claude Code only
Use plan mode for changes under `src/billing/`.
Code panel showing AGENTS.md and a CLAUDE.md that imports it, with numbered callouts for how Codex and Claude Code load each file
How each agent loads the two files, per the Codex AGENTS.md guide and the Claude Code memory docs.

Switching over from Codex? Claude Code's /init notices Codex configuration and offers to carry it across with /import codex, which brings over instruction files, MCP servers, commands, subagents and skills. There's a --dry-run flag to preview first. We cover writing the file itself in our guide to the CLAUDE.md file.

Permissions and sandboxing

This is where the two products differ the most by default.

Codex leans on the operating system. In its default mode, commands run inside a sandbox that limits writes to the workspace and keeps network access off. It uses Seatbelt on macOS, bubblewrap on Linux and WSL2, and a native sandbox on Windows when you run in PowerShell. An approval policy decides when Codex must stop and ask, for example before editing outside the workspace or using the network. The /permissions command switches to read-only when you only want to plan.

Claude Code leans on permission modes. With v2.1.283 or later, interactive terminal and VS Code sessions start in auto mode, where "a second model, the classifier" reviews actions in your place and blocks the risky ones. The other modes ask before most edits and commands (default), auto-approve file edits (acceptEdits), block edits until you approve a plan (plan) or allow only pre-approved tools for CI (dontAsk). Deny rules apply in every mode.

Claude Code also has an OS sandbox, but it's off by default. You turn it on with /sandbox or sandbox.enabled in settings. It wraps shell commands only. Claude's file tools, MCP servers and hooks run outside it. On native Windows, commands run unsandboxed, so you'd need WSL2.

Diagram comparing default safety layers: Codex with an OS sandbox on and an approval policy, Claude Code with auto mode classifier and an opt-in Bash sandbox
Defaults for a new local session, from the Codex sandbox docs and the Claude Code permission-mode and sandboxing docs.

The Codex default gives you a hard boundary you can reason about. Claude Code's default cuts down on prompts and relies on a reviewer model, with the hard boundary available when you switch it on.

Extending them: MCP servers, skills and plugins

Both agents speak MCP and read skills in the same SKILL.md format, which comes from the open Agent Skills standard. Both bundle extensions as plugins. The files just live in different places.

Feature Claude Code Codex
MCP servers claude mcp add; local, project or user scope codex mcp add; [mcp_servers.<name>] in config.toml
Skills .claude/skills/<name>/SKILL.md, ~/.claude/skills/ .agents/skills/ up to the repo root, $HOME/.agents/skills
Subagents Markdown files in .claude/agents/ TOML files in .codex/agents/
Hooks 34 events; handlers can be shell commands, HTTP endpoints, MCP tools, prompts or subagents 14 events in hooks.json or [hooks] in config.toml; command and MCP tool handlers
Plugins /plugin with marketplaces One plugin directory shared with ChatGPT; plugin browser in the CLI; not in the IDE extension
Headless runs claude -p codex exec

Adding the same MCP server to both takes one line each. This example uses the Context7 server from the Codex MCP docs, with the -- separator both CLIs document for local servers:

# Codex
codex mcp add context7 -- npx -y @upstash/context7-mcp

# Claude Code
claude mcp add context7 -- npx -y @upstash/context7-mcp

Hooks are the widest gap. Claude Code's hooks reference lists 34 events, from SessionStart and PreToolUse to WorktreeCreate and PreCompact. Codex lists 14, including three Claude Code doesn't have: PreModelRequest, PostModelRequest and Interrupt. Codex also makes you review and trust non-managed hooks before they run.

For subagents, Codex turns subagent workflows on by default and lets you define custom agents in TOML. Claude Code defines them in Markdown with YAML frontmatter. Our pieces on Claude Code skills, Claude Code hooks and Claude Code subagents go deeper on each one, and our list of the best MCP servers shows which servers support which client.

What published benchmarks show

A model benchmark scores a model. Terminal-Bench, hosted by Stanford and the Laude Institute, scores an agent and a model together on a public set of terminal tasks that anyone can rerun with its Harbor tool. The leaderboard reports the share of tasks resolved with a 95% confidence interval.

On Terminal-Bench 4.1, checked December 1, 2026:

Agent Model (effort) Resolution rate Release date
Claude Code Opus 5.5 (max) 65.8% ± 3.1% Sep 22, 2026
Claude Code Fable 5.2 (max) 65.8% ± 2.8% Nov 9, 2026
Codex GPT-6.2 Astra (max) 62.1% ± 2.3% Nov 17, 2026
Codex GPT-6.2 Sol (max) 61.5% ± 2.8% Nov 17, 2026

Read it with three caveats. The intervals for Claude Code with Opus 5.5 and Codex with GPT-6.2 Astra overlap, so the table doesn't clearly separate them. Every run here uses maximum reasoning effort, and OpenAI's model docs note that higher effort uses more tokens. And the tasks are the benchmark's, not your codebase. The top spot, for what it's worth, belongs to neither: GitHub Copilot with Copilot Fusion at 71.2% ± 2.9%.

Which one for which task

This table is built only from what the docs say each product does. It doesn't rank output quality.

If you need to Documented fit Why
Try an agent without paying Codex Free and Go include Codex in the desktop app; Claude Code isn't on the free Claude plan
Use what you already pay for Whichever plan you have Claude Code is in every paid Claude plan; Codex CLI starts at ChatGPT Plus
Contain commands on native Windows Codex Native Windows sandbox; Claude Code's sandbox needs WSL2
Run long sessions on a large codebase Claude Code Opus 5.5 with a native 1M-token window, against 272,000 or 500,000 default tokens in Codex
Automate around every agent action Claude Code 34 hook events and five handler types
Read or fork the agent's code Codex CLI under Apache-2.0
Get automatic PR review on a personal plan Codex Code review comes with Plus; Claude's Code Review is for Team and Enterprise
Keep a task running with the laptop closed Either Codex Cloud, or Claude Code on the web
Work from an Android phone Claude Code Documented for the Claude app on iOS and Android; Codex docs name iOS
Plan before any edits Either Plan mode in both, through /plan

Plan mode in Claude Code has more to it (approval options, a dedicated model alias). Our article on Claude Code plan mode walks through it.

Can you use Codex and Claude Code together?

Yes, and the docs give you four ways to connect them.

  1. One instruction file. Keep AGENTS.md as the shared source and add @AGENTS.md to a short CLAUDE.md, as shown above.
  2. One skills format. Both read SKILL.md folders from the Agent Skills standard, so a skill written for one is a copy (or a symlink) away from the other.
  3. Claude Code as a tool for Codex. claude mcp serve starts Claude Code as a stdio MCP server. Going by the documented syntax on both sides, registering it in Codex would look like this:
codex mcp add claude-code -- claude mcp serve

The reverse no longer works: OpenAI removed the codex mcp-server command and points integrations to its experimental app server.

  1. A second reviewer. Codex's GitHub review follows your AGENTS.md, so it can review pull requests that Claude Code wrote, against the same rules.

The cost is two subscriptions. Claude Pro plus ChatGPT Plus is $40 a month before tax at monthly prices.

FAQ

Is Codex better than Claude Code?

Not in any way the docs or the one agent-level benchmark can settle. On Terminal-Bench 4.1 their best entries sit within overlapping confidence intervals, so decide by the plan you already pay for and the sandbox default you're comfortable with (see the task table above).

Is Claude Code or Codex free?

Codex is, with limits. Free and Go get it only in the desktop app, and OpenAI marks that as subject to rollout, so it may not be on your account yet. Claude Code has no free tier: Anthropic's setup page says the free plan "does not include Claude Code access."

Does Codex use Claude Code?

No. Codex is OpenAI's own agent and runs GPT models.

Is Codex outdated?

No. OpenAI lists GPT-6.2 models for Codex, and the open-source CLI is under active development on GitHub. The name has a longer history at OpenAI; our explainer on what OpenAI Codex is covers it.

Which is cheaper at $20, Codex or Claude Code?

Same $20 a month, though Claude Pro drops to $17 on annual billing.

Where to Go From Here

If Claude Code is your pick, install it in one project, run /init, and keep the first CLAUDE.md short. Then add one hook or one skill at a time, so you can tell what each change did.

Put this into practice: the free Claude Code Starter Guide covers the five layers Claude Code is built from, why your quota burns and how to save it, and ten prompts that work on a real repo.

Now with NjectAI

Get the right answer from AI the first time

It knows you, your work and your voice before you type a word. Save your context once in NjectAI and ChatGPT, Claude and Gemini start from there.

  • Nothing to pay for 7 days
  • Cancel anytime
  • Set up in 2 minutes

Prompts for this topic

Put this article to work with ready-to-use prompts from the God of Prompt library.

Keep reading

The best of the blog, in your inbox

One email when notable prompts, tools, and model updates land. No spam, unsubscribe anytime.

Join 100,000+ subscribers. One email a week, real prompts, tools, and model updates. Unsubscribe anytime.