Claude vs ChatGPT for Coding: The Chat Apps Compared

Can ChatGPT code like Claude? In the chat apps, mostly yes. How the two differ at running code, previewing it, reading your repository and choosing a model, and the point at which a chat stops being the right tool and a coding agent is.

7 min read

In the chat apps, yes: ChatGPT and Claude can both write, explain, debug and review code, run Python in a sandbox, and preview a web page next to the conversation. The differences are in the details. Claude runs code through a general-purpose sandbox that also makes files, and keeps a selected slice of a GitHub repository in a project. ChatGPT runs Python from a code block, previews front-end code in the chat, and searches a connected GitHub repository on demand. In both, GitHub access from chat is read-only: neither chat app commits to your repository. Once you want that, you want a coding agent, Claude Code or Codex, not a better chat.

Running code

Both apps run code in an isolated environment rather than on your machine, and both let an administrator switch it off for a workspace.

  • Claude: code execution and file creation. Anthropic’s page on creating and editing files (opens in a new tab) says it is available on Free, Pro, Max, Team and Enterprise plans, on the web, desktop and mobile, and is switched on under Settings, Capabilities. Claude writes and runs code, Python or JavaScript for example, to analyse data, debug a snippet, or produce spreadsheets, slides, documents and PDFs you can download. On Team and Enterprise, owners choose its network access, from none, through package managers only (the default), to chosen domains or all. File work uses more of your plan’s usage than a plain chat.
  • ChatGPT: code blocks. OpenAI’s help centre describes code blocks that keep code apart from the answer so you can edit, copy, preview or run it. Preview renders HTML pages, React components, SVG, Mermaid diagrams and Vega or Vega-Lite charts in the chat; Run, for supported Python, opens a code workspace with a console showing output and errors, and you can stop code that is still running. Both happen in a sandbox, and ChatGPT may ask before a preview reaches outside resources.

In practice: for checking a calculation, cleaning a CSV or reproducing a bug in a small function, both are fine. ChatGPT’s Run button suits “does this snippet work” with a console you can watch. Claude’s sandbox suits jobs that end in a file, such as a spreadsheet of results or a chart as an image.

Previews, artifacts and Sites

Claude’s artifacts turn a response into a page beside the chat: a small web app, a diagram, a component you can click. ChatGPT retired its old side-by-side canvas on current models in favour of writing and code blocks in the conversation, and added Sites, in public beta, for hosted apps with their own database and sign-in. The detail, including sharing and plans, is in Claude Artifacts vs ChatGPT Canvas. For coding, the short version: a preview is a way to see front-end code work before you copy it into your project. Neither replaces the project.

Giving the chat your repository

This is where most coding answers go right or wrong. A model that can see the files you are asking about writes code that fits; one that cannot guesses names.

  • Claude: add a repository to a project. The GitHub integration (opens in a new tab) lets you pick files and folders from a repository, public or private, into a project’s knowledge or a single chat. It copies the file contents from one branch, not commits or pull requests, and updates only when you press Sync now. What you add has to fit in Claude’s context window, so choose the folders that matter rather than the whole tree. Access is read-only.
  • ChatGPT: connect the GitHub app. OpenAI’s help centre describes it as read-only: ChatGPT turns your question into searches of the repositories you authorised and pulls matching code on demand, rather than holding a copy. It says availability varies by plan and experience, with some plans offering GitHub in deep research but not in standard chat, and points you to Codex to edit and push code.
  • Projects on both sides keep instructions and uploaded files together across chats. OpenAI’s Projects documentation (opens in a new tab) notes that a ChatGPT project on the web has no direct access to a folder on your computer, so you upload or connect sources; folder access belongs to the desktop app’s local projects, which is Codex and Work territory.

The practical difference: Claude’s project gives the model the same chosen files every time, which suits a module you are working on for a week. ChatGPT’s search fetches what the question seems to need, which suits “where do we handle uploads” across a large codebase. Neither sees your uncommitted changes, so paste those in.

Models, by plan

  • Claude’s model selector lists the models your plan and organisation allow, among them Opus 5.5 and Sonnet 5, each with an effort setting. The larger Fable 5 and Fable 5.1 are, according to Anthropic’s Fable plan page (opens in a new tab), included on Max and on premium Team and Enterprise seats, and used with usage credits on Pro and standard Team seats.
  • ChatGPT’s chat picker also varies by plan. OpenAI’s models page (opens in a new tab) says its newest coding models, GPT-6 Sol and GPT-6 Luna, are available in Work and Codex but not in Chat, and that GPT-5.5 retires from ChatGPT on 14 October 2026.

That second point is worth reading twice if you choose ChatGPT for coding: OpenAI puts its coding-first models in Codex, not in the chat box. On the Claude side, Claude Code and the chat app draw on the same family of models. For how the Claude models differ in practice, see Claude Sonnet vs Opus.

Which chat to use for which job

  • Learning a language or a library, with explanations and small exercises: either. Pick the one whose explanations you find clearer.
  • Asking about a codebase you cannot upload in full: ChatGPT’s GitHub search, where your plan offers it in chat.
  • Working on one module for days with the same context: a Claude project with those folders synced from GitHub.
  • A quick script whose output you want to see: ChatGPT’s Run button, or Claude with code execution on.
  • A result that is a file, such as a spreadsheet, a PDF report or a chart: Claude’s file creation.
  • A front-end component you want to look at before you use it: either preview, then paste it into your project and test it there.

When to move from chat to a coding agent

A chat app is a good pair of eyes and a poor pair of hands. Move to an agent when you notice any of these: you are copying code between the chat and your editor more than twice for one change; the answer depends on files the chat cannot see; you need tests to run against your real dependencies; or the change touches more than a handful of files. Claude Code and Codex both work inside your repository, run your commands under permission rules and hand back commits or pull requests. Codex now also has its own view in the ChatGPT desktop app. How the two agents compare is covered in Claude Code vs Codex. For longer, non-coding delegated work in each app, see ChatGPT Work vs Claude Cowork.

Keep the work list out of the chat history

Whichever you use, the list of what to build next tends to live in scattered chats. A fenbs board keeps it in one place that both can reach over MCP, where your plan lets you add your own MCP server: each task is a feature, enhancement or bug with a priority from 1 to 10, a note and a plan, moving through To Do, Next Up, In Progress and Completed. Claude or ChatGPT can read a task, add a comment with a proposed fix, or file a bug it spotted, and the history records which assistant did it on whose behalf.

Related

Connect a chat app to a board: Claude and ChatGPT. Better prompts for code questions: Claude prompting best practices. Choosing a coding agent: the best AI coding agents.

Questions people ask.

Can ChatGPT code like Claude?

For writing, explaining and debugging code in a chat, yes. Both run Python in a sandbox and preview front-end code. They differ in how they read your repository, how they create files and which models each plan offers in chat. For changes inside a real repository, both companies point you to their coding agents, Claude Code and Codex.

Can ChatGPT or Claude push code to my GitHub repository from chat?

No. Claude’s GitHub integration and ChatGPT’s GitHub app are read-only in chat. To edit files and open pull requests, use Claude Code or Codex, which work in a repository and hand back commits for you to review.

What is the best ChatGPT for coding?

In the chat, use a plan and model with code execution and the GitHub app available. For coding work on a repository, OpenAI puts its newest coding models in Codex and ChatGPT Work rather than in Chat, so Codex is the better fit for real changes.

Is Claude better than ChatGPT for coding?

Neither wins everywhere. Claude suits keeping a chosen part of a repository in a project and producing files; ChatGPT suits searching a large connected repository and running snippets with a visible console. Try both on a real question from your own codebase.

Start with one thing.

There is nothing to set up first. Write one line and you’ve started.