"Claude Code or Codex?" usually gets asked as if one of them has to win for good. That's the wrong question. These two coding agents overlap far more than feature comparisons suggest, and where they do split, the difference is about how you like to work, not about which one is better. I'll start with what they share, then what each does its own way, and finish with a simple way to divide work between them.
Two agents, one shape
First, what they are. Claude Code is the coding agent from Anthropic, the company that makes the Claude models. Codex is OpenAI's equivalent. Mind the name: this isn't the old Codex model from 2021, which was retired long ago. It's a full agent built from scratch.
"Agent" here means a program you hand a task to, say "fix this bug" or "add a new feature", and it plans the steps itself, opens your project, edits files, runs commands, and asks for your permission wherever you've told it to ask.
Both run in the terminal, as a VS Code extension (Codex also works in VS Code forks such as Cursor), as a desktop app for Windows and macOS, and in a cloud version. Claude Code runs on the Claude family: Opus, Sonnet and Haiku. Codex runs on GPT models, including variants tuned for code.
The shared list is long, and it's worth knowing before you go looking for differences. Both agents:
- edit code on your own machine and use the command line;
- support MCP, the open standard for connecting outside tools to an AI, such as a calendar, a database or a ticketing system;
- read skills in the same format: a text file with a short description header, dropped into a folder, which the agent picks up when it fits the task;
- have a marketplace of community plugins;
- let you send a task to the cloud and walk away;
- have hooks, automatic triggers that fire when something happens in a session (you send a prompt, a tool runs, a session starts);
- have sub-agents, specialist helpers the main agent hands a slice of the work to.
Since both have all of that, "does my tool have feature X?" stops settling anything. What's left is which one gives you the better way of working on the task in front of you today.
Where Claude Code goes further: depth of customization
In my view, what sets Claude Code apart is how far you can shape it to your own way of working. It's less a finished tool and more a system you assemble for yourself.
Hooks show this best. At the time of the comparison (May 2026), Claude Code had around 30 kinds of events you could attach automatic behaviour to, and Codex had around six. If you want things to happen on their own at every point in the agent's work, Claude Code gives you many more places to hook in.
The second difference is sub-agents. Claude Code can decide by itself that a task is complex and bring in helpers: one to plan, one to search the project, one to review the code. The Codex documentation says plainly that Codex won't start sub-agents unless you explicitly ask it to.
Then there's a set of features with no Codex counterpart, or with one that works differently:
- /ultraplan moves the planning stage to a cloud session, where you review the plan in a browser and comment on specific parts, then send it back to your terminal to execute. /ultrareview runs several reviewer agents in the cloud and returns a code review with reproduced findings. Both were in preview at the time, and ultrareview bills per run once the runs included in your plan are used up.
- /loop runs a prompt on a recurring schedule. Without a prompt, the agent switches to tidying the project: finishing half-done tasks, answering comments on pull requests, resolving merge conflicts.
- Channels push messages from Telegram, Discord or iMessage into a running session. You can simply text your agent from your phone.
- The Agent SDK exposes the same engine that powers Claude Code as a Python and TypeScript library, so you can build your own agents on it.
- Sign-in through enterprise clouds: Claude Code works through Amazon Bedrock, Google Vertex AI and Microsoft Foundry. If you work alone you probably don't need this, but in a company that hosts its AI on one of those platforms it's often the price of entry.
Where Codex goes further: one flow from task to shipped code
Codex has a different philosophy. Instead of a system you assemble, it gives you a fixed, pre-built path from "the agent is done" to "the code is in production".
The core of that path is worktrees: separate working copies of the same project, so several tasks can run side by side without overwriting each other's files. In Codex, every thread can run in its own worktree from the start, and the same app lets you review the changes, commit them and push them to the repository. Claude Code supports worktrees too, but in Codex they are simply part of how the app works.
The other standouts:
- A browser inside the app. You open what the agent just built and leave comments directly on the page. Claude has a Chrome extension, but it lives in the browser, not in the agent's app.
- App testing through computer use. Both tools can click around a screen, but Codex has a polished QA flow: you ask it to test your app, and it opens it, clicks through, finds bugs and logs them with a severity rating, expected versus actual behaviour, steps to reproduce and a triage summary.
- @codex on GitHub. You tag Codex in a pull request comment or an issue, and it spins up an isolated cloud environment and gets to work. No setup.
- /goal. You set a goal with a stopping condition that can be checked, and the agent keeps working until it's met, even for several hours. It was experimental and had to be switched on by hand. Shortly afterwards Claude Code shipped its own /goal, so this gap has closed.
- Built-in image generation. Codex has access to OpenAI's image model, so artwork for a game, a product mock-up or a website gets made in the same app. Anthropic has no image model of its own, so in Claude Code you connect an outside tool.
One more difference has nothing to do with features and everything to do with subscription rules. OpenAI publicly allows you to sign in with your ChatGPT account inside third-party agent wrappers and use your plan's limits there. Anthropic takes the opposite position in its Agent SDK documentation: unless previously approved, third-party products may not offer Claude account sign-in or use its limits. If you spend a lot of time in those wrappers, that single rule changes the maths more than the plan price does.
Pricing and context windows: check before you trust the numbers
Both agents come with their platform's subscription, so you don't need a separate API key to start. At the time of the comparison (May 2026), Claude Code was available from the Pro plan at 20 dollars a month, with heavier daily use covered by the Max plans at 100 and 200 dollars. Codex was included in every ChatGPT plan, from the entry tier through Plus at 20 dollars up to Pro at 200 dollars.
They also differed on the context window, the amount of text a model can hold in view at once. It's measured in tokens, the chunks of text a model reads and writes in (a token is usually part of a word). Opus and Sonnet in Claude Code had a window of up to one million tokens; the latest GPT in Codex had about 256,000.
Both companies ship changes very fast: new models, new price tiers, features leaving preview or being pulled. The differences in philosophy I described above will probably hold. The exact prices and limits you should check in each tool's current documentation before you decide anything on them.
Three identical prompts, two different results
In a comparison on three identical prompts, both agents got the same tasks in their own desktop apps: a branded research report as a PDF, a full landing page, and an interactive analytics dashboard with made-up but realistic data. Codex ran on GPT-5.5, Claude Code on Opus 4.7, both at a high effort setting.
Neither side swept it.
Front end and visual design: Claude Code. Claude Code's landing page had the stronger design foundation: animation, glow effects, real icons instead of placeholder letters, and a less generic look overall. It also had mistakes. The logo was missing, and the scrolling banner showed the wrong brand logos. One follow-up prompt would fix both. Both dashboards worked the same way, but Claude Code's looked clearly better, and it was finished in under 2 minutes against roughly 8 minutes on the Codex side.
Reports and documents: Codex. The Codex report was shorter and more structured (a table for each tool it covered), with better spacing. Claude Code's version was longer and written like a story, with a nicer header and footer but a broken title layout. As something to send a client, the Codex report came out slightly ahead. Codex also used noticeably fewer tokens on that task.
Output tokens: Codex is leaner. On all three tasks, Codex wrote two to five times fewer output tokens than Claude Code. Output tokens cost more than input tokens, so this shows up in how quickly you burn through your subscription's session limit. Claude Code tended to plan carefully before executing; Codex more often took repeated passes, which pushed up its input tokens on the complex builds.
Two caveats keep these results from being over-read. First, much of the difference comes from the model underneath, not the tool itself. When new model versions arrive, the numbers will move. Second, this is three runs, not statistics, and one of them was a clear outlier. Treat it as a pointer to where the differences sit, not a verdict.
One practical thing you can repeat yourself: both agents record each session in a log file (JSONL format). Ask the agent to read that file and pull out the time, token counts and cache reads. That way you compare the two tools on your own tasks rather than someone else's.
Temperament: brainstorming partner and executor
Beyond the numbers there's something harder to measure that weighs heavily in practice. Claude Code behaves more like a thinking partner. It suggests, asks questions, and will push back when you're heading the wrong way. Codex sticks to instructions better, especially as a project runs longer: you tell it what to do and it does it. It's also strong at reviewing code and plans, which means catching bugs and gaps.
That's a qualitative observation, not a measurement. Still, it points to a split that makes sense whichever agent happens to be faster this month:
- Plan and think with Claude Code. Brainstorming, strategy, breaking down a hard problem.
- Execute or review with Codex. Codex gets a finished plan to carry out, or existing code to review and poke holes in.
The feature map leads to the same split. Reach for Claude Code for complex front-end work, when visual quality matters, when the task needs deep planning, when you want automatic sub-agents or custom workflows built from hooks, skills and channels, when you're embedding an agent in your own product through the Agent SDK, or when your company requires Bedrock or Vertex. Reach for Codex for research-heavy tasks that pull from the web, for structured documents and reports, when you want one app from worktree to shipped code, for @codex on GitHub, and when the project needs image generation.
A project is a folder, not a cage
One last point takes most of the weight off this decision. When you work with a coding agent, you're creating files in folders: Markdown instructions, JSON configuration, scripts. All of it goes into a repository, and you can open it in any agent.
Moving from one tool to the other is straightforward. You open the project in the second agent and tell it: this project was built in a different tool, walk through it, understand it, and update whatever needs changing. Mostly that means the instructions file: what Claude Code reads from CLAUDE.md, Codex reads from AGENTS.md. The agent will handle the rest. You can also keep two versions of the project, one per tool.
The principle I take from all this: you don't choose an agent for good, you match it to the task in front of you, and portable files make that choice cost you nothing. If you have access to both, take one real task from this week, run it through each agent, and compare the result and the session log. One trial like that will tell you more than any feature table.
Your team already uses Claude Code? See the Claude Code pilot.
Your team works with Codex? See the Codex pilot.