Guide · Codex context window

Codex Context Window: Size, the 1M Setting, How to Check

The Codex context window is how much one chat can hold at once: your messages, the files Codex read, its tool output and its own replies. When it fills, Codex summarizes the chat and carries on from the summary. That is why a long session can suddenly forget a detail from an hour ago.

The number depends on the model, and the answer people search for, 1M, is not what you get. In OpenAI’s source today, most Codex models have a 272,000-token window, GPT-6.1 Terra has 500,000, and the setting that raises it stops at the model’s own cap. Below is each number, where it comes from, how to watch it in the CLI and the app, and how it differs from the five-hour and weekly limits that actually end your day.

We make Context Board, which shows those plan limits and your Codex sessions on one screen. It does not show one session’s context, and the last section says so plainly. Everything about Codex here is from OpenAI’s docs and the openai/codex repository, read on October 27, 2026.

Quick answer
  • Size: 272,000 tokens for every visible model in Codex’s bundled list except GPT-6.1 Terra, at 500,000. About 95% of that is usable, which is where the “258K” figure comes from.
  • 1M: the API lists GPT-6.1 Sol at 1,050,000, but Codex caps model_context_window at each model’s own maximum, 872,000 in the bundled list. There is no 1M switch.
  • See it: type /status for the Context window row, or add context-remaining to the footer with /statusline.
  • Compaction: Codex summarizes the chat on its own at 90% of the window. /compact does it on demand.
  • Not your limit: the window is per chat. Your five-hour and weekly limits are per plan, and a bigger window spends them faster.

How big is the Codex context window?

OpenAI’s docs do not print a window size. The Codex pricing page lists models, plans and message ranges, and says nothing about window sizes. The numbers live in the model list that ships inside the openai/codex repository, which is where this table comes from.

ModelDefault windowHighest settingUsable (95%)
GPT-6.1 Terra500,000872,000475,000
GPT-6.1 Sol272,000872,000258,400
GPT-6 Astra272,000872,000258,400
GPT-6 Luna272,000872,000258,400
GPT-5.5272,000272,000258,400

Read it with three caveats.

  • It is a snapshot of the source, not of your account. Codex also fetches a model list from OpenAI and keeps a copy. A bug report filed on October 18 pasted that copy and showed GPT-6.1 Sol at 500,000, not 272,000 (issue 55008). That is one user’s file, not an OpenAI statement, but it is a reason to read the number off your own screen. The next section shows how.
  • Terra is new. The commit that added it to the list landed on October 26, and OpenAI’s changelog says it is available in Codex on Plus, Pro, Business, Enterprise and Edu plans.
  • GPT-5.5 is on the way out. OpenAI’s pricing page says it retires from Codex with ChatGPT sign-in on October 14, 2026.

The “Usable” column explains a number you may have seen. Codex’s source reserves headroom for the system prompt, tool overhead and the model’s reply, and counts 95% of the window as usable. 95% of 272,000 is 258,400, the “258K” that some guides call the real size of a 272K window. It is the same window, measured after the reserve.

The window is set per model, not per plan. The list has one value for each model, and OpenAI’s pricing page does not describe a different window on Plus than on Pro. What your plan changes is which models you can pick and how much allowance you get, which is the second half of this post.

Can you turn on 1M context in Codex?

No, and the reason is worth knowing, because several posts that rank for this say otherwise.

The 1M figure is real for the model. OpenAI’s API page for GPT-6.1 Sol lists a 1,050,000-token context window, 128,000 maximum output and a 922,000 maximum input. It also says that a prompt over 272,000 input tokens is billed at twice the standard input rate for the whole request, and at 1.5 times the output rate. That is an API price, not a Codex one, but note the number: 272,000 is also Codex’s default window.

Codex does not hand you that whole window. It has a setting, model_context_window, which the config reference describes as “Context window tokens available to the active model.” In the code that applies it, the value is clamped to the model’s own maximum (model_info.rs). For the GPT-6 family that maximum is 872,000 in the bundled list. For GPT-5.5 it is 272,000 in today’s list, the same as its default.

That gap is where the 1M confusion comes from. A GitHub issue from April, closed the same day, reported that on GPT-5.4 and GPT-5.5 the 1M setting was ignored in the VS Code extension and Codex stayed near 258K. The window you can use in Codex is the model’s cap in Codex’s own list, not the API figure.

How to raise the window anyway

If you want a bigger window on a model that allows one, set it in your Codex config file, ~/.codex/config.toml by default.

model_context_window = 500000

Three things to know before you do.

  • Anything above the model’s cap is clamped. Setting 1000000 on a model capped at 872,000 gives you 872,000.
  • Lowering auto-compaction works, raising it does not. In the source, the auto-compact limit is the smaller of your setting and 90% of the window. You can make Codex compact earlier. You cannot push it past 90%.
  • A bigger window costs more per message. OpenAI’s pricing page says “extended sessions that require the agent to hold more context will use significantly more per message.” A chat that carries 400,000 tokens drains your plan faster than one that carries 40,000.

A larger window also does not make a long chat better. The model still works from a lot of old material, and the more there is, the more of your allowance each reply spends. For most work, a fresh chat with a tight brief beats a very long one.

How to see how much context Codex has used

Codex shows the number in four places. None of them needs an extra tool.

/status in the CLI

Type /status in a running session. OpenAI’s CLI command reference says it displays session configuration and token usage, and confirms “the active model, approval policy, writable roots, and remaining context capacity.”

The Context window row is the one you want. In the source it is formatted as a percentage left, then the tokens used out of the window, so a chat with 60K tokens in it reads something like 82% left (60K used / 272K). The last number is your actual window, which settles the question of whether you have 272,000 or 500,000. It is also the same screen OpenAI points to for your remaining plan limits.

The CLI footer can show how much context is left as a plain line, formatted in the source as “82% context left”. If you see it, you do not need to type anything.

/statusline

If the footer does not show it, or you want more, type /statusline. OpenAI describes it as configuring the status-line fields interactively, and the setting behind it is tui.status_line in your config. The source lists these context items:

  • context-remaining: the percentage of the window left.
  • context-used: the percentage used.
  • context-window-size: the window in tokens.
  • used-tokens: total tokens used in the session.

It also lists five-hour-limit and weekly-limit, so one footer can show a chat’s context and your plan together.

[tui]
status_line = ["model", "context-remaining", "five-hour-limit", "weekly-limit"]

The picker writes this for you, so you rarely need to type it. The context items only appear once Codex knows the figure.

The desktop app

In the Codex desktop app, OpenAI’s slash-command list says /status shows “the chat ID, context usage, and rate limits,” and /compact compacts the current chat’s context. The app also has a context tooltip. One bug report on a GPT-6.1 Sol chat quotes it as “63% full, 299k / 475k tokens used,” which fits the 500,000 window in that report rather than the bundled 272,000.

If you want to see the list your own Codex is using, the CLI source includes a debug command, codex debug models, that dumps the model list after refreshing it. Its —bundled flag skips the refresh and dumps the list shipped with your binary. It is a debug command, so it may change.

What compaction does

Compaction is how Codex survives a long chat. It replaces the history with a short summary, and the chat carries on from there.

Codex does it in two ways.

  • Automatically. In the source, the auto-compact threshold is 90% of the window, or your own lower limit if you set model_auto_compact_token_limit. On a 272,000 window that is 244,800 tokens. The config reference says that when the key is unset, model defaults apply.
  • On demand. /compact in the CLI summarizes the visible chat to free tokens. Use it at a natural break, such as after a feature lands, rather than waiting for the automatic one to hit in the middle of a task.

What gets written is a handoff note. The compaction prompt in the source asks the model to create a “handoff summary for another LLM”: current progress and key decisions, important constraints and preferences, what remains, and any data needed to continue. In the local path, Codex also keeps your recent messages, up to 20,000 tokens of them, and adds the summary after them. You can replace the prompt with compact_prompt in the config. Codex can also use remote compaction, which the config reference lists as a provider capability. OpenAI’s API compaction guide says the compacted state it returns is an opaque item “not intended to be human-interpretable.”

Compaction is lossy, and it has rough edges right now. An open GitHub issue from July reports that image payloads can survive local compaction and trigger it again and again. In the 0.164.0 release notes on October 23, OpenAI fixed failed compactions leaving partial summaries in a chat’s history.

A few habits help.

  • Write down the decisions that matter. Put them in a file or in AGENTS.md, not only in the chat. A summary can drop a detail. A file does not.
  • Compact at a clean point, and say what comes next in the following message.
  • Start a new chat for a new task. /new starts a blank chat in the same CLI session, and the old history stops counting.
  • Be careful with screenshots. Images can survive compaction, as the open issue above describes.

Keep AGENTS.md lean

AGENTS.md is the one part of the context you write yourself, and it goes into every chat. So it is a cheap place to save tokens.

Codex builds its instructions from AGENTS.md files, per OpenAI’s AGENTS.md guide. It reads one at the global level, then walks from the project root down to your working directory, taking at most one file per directory, and joins them root first. Files closer to you come last and override earlier ones. Codex stops adding files once the combined size reaches 32 KiB by default, set by project_doc_max_bytes.

So a long AGENTS.md has two costs. It uses window in every chat, and past 32 KiB the rest is cut. OpenAI’s pricing page gives the same advice for your allowance: remove unnecessary context, shrink AGENTS.md files, and “control how much context you inject” by nesting AGENTS.md files in a larger repo.

What to keep:

  • Commands: how to build, test and lint, exactly as you type them.
  • Rules that are not obvious: the migration you must not touch, the folder that is generated.
  • Pointers: a line that says where the architecture notes live, rather than pasting them in.

What to cut: the tour of the repo, style rules your linter already enforces, and anything you wrote in case it helped. If a rule only matters in one folder, put it in an AGENTS.md in that folder.

MCP servers matter too. The same pricing page tells you to disable MCP servers you aren’t using, because each one adds context. Our guide to listing your MCP servers in Claude Code and Codex shows how to see which ones are on. If you run Codex and Claude Code in the same repo, Claude Code can read AGENTS.md too, as Claude Code vs Codex explains.

Context window vs the five-hour and weekly limits

These two get mixed up, because both end in “Codex stopped.” They are different things.

Context windowFive-hour and weekly limits
What it measuresHow much one chat holds at onceHow much work your plan allows over time
ScopeA single chatYour whole account and plan
When it runs outCodex compacts and carries onCodex stops until the reset, or you use credits
Where to see it/status Context window row, the footer/status limits, chatgpt.com/codex/settings/usage
Reset/new or compactionA timer, shown on the usage page

On Plus, OpenAI’s pricing page gives estimated local messages per five-hour window by model, for example 15 to 160 on GPT-6.1 Sol and 350 to 3,000 on GPT-6 Luna, and says they “are not fixed message limits.” It adds that weekly limits may also apply, and that Pro plans currently have no five-hour limit. Our guide to checking Codex usage covers where each number lives and how resets work.

The two connect in one place. The same page says that model choice, context, reasoning, tool use and caching all affect usage, and that holding more context uses more per message. So a full 500,000-token chat is not just a longer chat. Each reply in it spends more of the five-hour window than a reply in a fresh one.

Here is the practical version.

  • Codex forgot something: that is the context window. Compaction happened. Re-state the detail, or put it in AGENTS.md.
  • Codex stopped and shows a reset time: that is a plan limit. A new chat will not help.
  • Your windows empty faster than you expect: look at how long your chats run. A fresh chat per task is the cheapest fix.

If you only want your plan numbers, our free Codex usage checker reads them from your sessions folder in your browser. Weighing a different coding agent altogether? Claude Code vs OpenCode compares two more.

What Context Board shows, and what it does not

Context Board is ours, so weigh the bias. Here is the plain version of what it covers for Codex.

It shows your plan, not one chat. The AI usage widget draws what is left of your Codex five-hour window and week as rings, each with when it resets, as Codex last checked. The Agent activity and Needs you widgets list every Codex and Claude Code session on your computers, with its title and project, and whether it is working, done or waiting for you.

It does not show how full one session’s context is. For that, use /status or the footer in the session itself.

AI usageCodexnow
Codex
58%leftCurrent sessionresets in 2h 40m
41%leftThis weekresets Thu 2:00 PM
As they last checked, 2m ago
Codexapi · main2m
Working
Moving the webhook queue to Postgres
Added the retry tests
Needs you1 sessionnow
  • Codex · docsasks to run the test suite3m
An example Context Board named Agents. Every number on it is example data.

The two views answer different questions. The footer tells you whether this chat is about to compact. The board tells you whether your plan can take another big task, and which sessions are waiting while you are in another window.

The widgets read your computer through a small program you set up once with one line from Connect. Only names, states and percentages leave your computer, never what was said in a session. You add AI usage yourself from the gallery, and the Agents template has it already. Context Board is free for 3 days, then $12 a month.

A short routine for long Codex sessions

Pulling it together, this is what we would do.

  1. Run /status at the start of a long task and note the window, so you know whether you have 272,000 or more.
  2. Add context-remaining and five-hour-limit to your footer once, and glance at it between tasks.
  3. Keep AGENTS.md short, with commands and non-obvious rules, and move per-folder rules into nested files.
  4. Compact at a clean break, or start a new chat for the next task.
  5. Save decisions that must survive in a file, not only in the chat.
  6. Leave model_context_window alone unless you have a reason. If you raise it, watch your five-hour window afterward.

Frequently asked questions

Something else on your mind? Get in touch.

How big is the Codex context window?

It depends on the model. In the model list that ships with Codex's source today, every visible model has a 272,000-token window except GPT-6.1 Terra, which has 500,000. Codex treats about 95% of the window as usable, so 272,000 reads as roughly 258,000. OpenAI does not publish a per-plan window, so check yours with /status.

Does Codex have a 1M context window?

Not as a switch you can flip. OpenAI's API lists GPT-6.1 Sol with a 1,050,000-token window, but Codex limits the model_context_window setting to the model's own maximum, which is 872,000 in the bundled model list for the GPT-6 family. The old GPT-5.5 1M complaints are about a model that left Codex with ChatGPT sign-in on October 14, 2026.

How do I see how much context Codex has used?

In the CLI, type /status for a Context window row, or watch the footer line that reads like 82% context left. /statusline adds context-remaining, context-used and context-window-size to the footer. In the Codex desktop app, /status shows chat ID, context usage and rate limits.

What does /compact do in Codex?

It asks the model to write a handoff summary of the chat so far, then continues from that summary instead of the full history. OpenAI's docs describe it as summarizing the visible chat to free tokens. Codex also compacts on its own when the history reaches 90% of the window.

Is the context window the same as the five-hour and weekly limits?

No. The context window is how much one chat can hold at once. The five-hour and weekly limits are how much total work your plan allows. They connect in one way: OpenAI says extended sessions that hold more context use significantly more of your allowance per message.

Does Context Board show Codex context usage?

No. Context Board's AI usage widget shows what is left of your Codex five-hour window and week, and its Agent activity and Needs you widgets list each session and whether it is working or waiting for you. None of them shows how full one session's context is. It is free for 3 days, then $12 a month.