Code tokenises more densely than prose, so a repository that looks small in megabytes can be very large in tokens. Fitting it is one question; using it well is another.

Computed from this tool’s default settings — lines of code and the rest as most people start. Change them below for your own case.
50,000 lines are about 486K tokens, more than the window holds. Retrieve the relevant files rather than paging the whole repository through the model.
Lines of code to tokens, against real context windows.
50,000 lines are about 486K tokens, more than the window holds. Retrieve the relevant files rather than paging the whole repository through the model.
| Window | Fills | Verdict |
|---|---|---|
| 8K | 5,934% | Needs 60 passes |
| 33K | 1,483% | Needs 15 passes |
| 131K | 371% | Needs 4 passes |
| 200K | 243% | Needs 3 passes |
| 272K | 179% | Needs 2 passes |
| 1M | 49% | Fits |
Every input moves the result for a reason. This is what each one does and where to find the value for your own machine.
| Setting | Default | What it changes |
|---|---|---|
| Lines of code | 50000 | Your own figure, starting from 50,000. Change it to match what you actually run. |
| Average characters per line | 35 | Anywhere from 5 to 200. |
| Characters per token | 3.6 | English prose runs near 4; code is denser, nearer 3.2–3.6. |
| Model context window | 128000 | 6 options, from 8K to 1M. |
The same calculation run at a range of settings, with everything else left at its default. These are computed by the tool itself, not written by hand.
| Model context window | Your codebase | Characters | Share of window | Context window |
|---|---|---|---|---|
| 8K | 486K tokens | 1.8M | 5,934% | 8,192 |
| 32K | 486K tokens | 1.8M | 1,483% | 32,768 |
| 128K | 486K tokens | 1.8M | 371% | 131,072 |
| 200K | 486K tokens | 1.8M | 243% | 200,000 |
| 272K | 486K tokens | 1.8M | 179% | 272,000 |
50,000 lines are about 486K tokens, more than the window holds. Retrieve the relevant files rather than paging the whole repository through the model.
No lookup tables and no invented constants. Here is the arithmetic, so you can check it against your own numbers.
Code tokenises more densely than prose because identifiers, punctuation and indentation all consume tokens. Three and a half characters per token is a reasonable working figure for most languages, and it is an input here so you can correct it from a real count.
Fitting is not the same as being used well. Attention quality degrades across a very long window, so a codebase that technically fits in 1M tokens is usually still better served by retrieving the relevant files.
These are well-founded engineering estimates, not benchmark results. Your quantisation, runtime and context length all move the real number, and usable memory is an assumption rather than a specification. See the full methodology for every assumption behind these figures.
The three situations that bring people to this calculation.
See whether a repo fits the window at all.
Match context window to codebase size.
Decide when to retrieve rather than stuff.
Four steps, no account, nothing leaves your browser.
Start at the top of the panel. Every figure recalculates as you change it — there is no submit button, because watching the number move is the point.
3 further settings: average characters per line, characters per token, model context window. Defaults are the common case, so change only what differs for you.
The large figure answers the question. The table underneath shows how the answer changes across nearby settings, which is usually where the decision actually gets made.
The arithmetic is written out above. If a number looks wrong for your hardware, the assumptions are the first place to look — usable memory and quantisation are the two that vary most.
The questions people ask about this, answered without hedging.
Roughly characters divided by 3.5. Code is denser than prose because identifiers, punctuation and indentation each consume tokens — 50,000 lines is commonly around half a million tokens.
Rarely, even when it fits. Attention quality thins across a very long window and cost rises the whole way. Retrieving the relevant files usually produces better answers for less money.
Usually not. Good retrieval over a 128K window outperforms naive stuffing of a million, and it costs a fraction as much per request.
Because each turn resends the conversation, and keeping every file in history gets expensive quickly. Selective reading is a cost strategy, not a limitation.
All 50 run on the same arithmetic, so answers across them agree.
Different ways of asking the same question, all resolved above.
Sizing is only half the problem. Model Radar takes your hardware and shows which models actually run on it, ranked by what they are good at — the same arithmetic as this page, applied to every model worth running.