Formulas and sources
Each formula this calculator uses, where it comes from, and what it leaves out. "How it works" shows the same formula with your own numbers.
Tokens from text
Simple and Composer modes, for pasted text, a file or a typed character count
- Tokens
- the estimated token count, rounded up
- Characters
- the characters in the text
- C
- characters per token: 4 for Generic and GPT, 2.7 for Claude 4.7 and later, 3.2 for Gemini; for JSON, 3.2 for Generic and GPT and 2.4 for Gemini; for CSV, 2.7 and 1.9
Each estimate is rounded up. Claude’s 2.7 is 3.5 ÷ 1.3 = 2.69, rounded to 2.7: Anthropic’s 3.5 characters a token, with about 30% more tokens on the newer tokenizer. Gemini’s 3.2 is the 60-word end of Google’s 60 to 80 words per 100 tokens; Google’s page says about 4 characters a token. JSON and CSV have their own ratios, because data takes more tokens for its length. A text is JSON when the whole of it is a valid JSON object or array. It is CSV when it has at least three lines, nine in ten of the first fifty split into the same three or more short fields at a comma, tab or semicolon, and most lines do not end like code or a sentence. In Composer each section is checked on its own. Claude has no measured JSON or CSV ratio yet, so a Claude count of either uses its text ratio.
Source: GPT and Generic: OpenAI’s rule of thumb of about 4 characters a token [1]. Claude: CalcTrail’s own estimate, from Anthropic’s “about 3.5 characters” [2] and its “approximately 30%” more tokens [3]. Gemini: CalcTrail’s own estimate, within Google’s range [4]. Anthropic calls its own token count an estimate [5]. JSON and CSV: CalcTrail’s own measurement on October 7, 2026, counting generated JSON and CSV samples with the o200k_base tokenizer OpenAI uses for its GPT-5 models [6] and with Google’s token counter [4].
Tokens from a word count
Simple mode, when a word count is typed
- Tokens
- the estimated token count, rounded up
- Words
- the word count you type
- R
- tokens per word: about 1.333 for Generic and GPT, 1.9748 for Claude 4.7 and later, 1.6663 for Gemini
R is OpenAI’s 1.333 tokens a word (1 ÷ 0.75), scaled by each family’s characters per token. One word is 5.33 characters in every family, so a typed word, character or token count gives the same estimate.
Source: Based on OpenAI’s rule of thumb of 0.75 words a token [1]; Claude and Gemini are scaled as above, CalcTrail’s own estimates [2] [3] [4].
Words from a token count
Simple mode, when a token count is typed
- Words
- the estimated word count, to the nearest word
- Tokens
- the token count you type
- R
- tokens per word, as above
So 8,000 tokens is about 6,002 words at the generic ratio and about 4,051 for Claude 4.7 and later.
Source: Based on OpenAI’s rule of thumb of 0.75 words a token [1].
Exact count for GPT-5
Simple and Composer modes, when you select Count exactly for GPT-5
The text is counted with o200k_base, the tokenizer OpenAI’s own tiktoken assigns to its GPT-5 models. It runs in your browser, so the text is not sent anywhere; about 1 MB is downloaded the first time. OpenAI names no tokenizer for GPT-6, and Claude and Gemini have none a browser can run, so their counts stay estimates.
Source: OpenAI’s tiktoken model map [6]; counted with gpt-tokenizer 4.0.0, an open-source implementation of the same tokenizer.
Composer total
Composer mode
Each section is counted on its own and rounded up, then the counts are added, so the section shares add up to 100%.
Source: CalcTrail’s own; no publisher.
Counts of the text
Simple and Composer modes, for pasted text or a file
Words are the pieces of text between spaces, so a language written without spaces counts as one word. Characters are code units as stored, so an emoji counts as 2. A sentence ends at ".", "!" or "?" before a space or the end, so the count is approximate. An entered count has no text, so it shows no sentence, line or word-length figures; its words and characters follow from the ratio.
Source: CalcTrail’s own; no publisher.
Context window fit
Simple and Composer modes
Share = (Tokens + Expected reply) ÷ Window. A share of 90% or more is marked tight, because the token count is an estimate. Each family is checked against one current model and its reply limit, from CalcTrail’s model catalog.
Source: CalcTrail’s own; no publisher.
Ways to use fewer tokens
Simple and Composer modes
Minify the JSON removes the white space outside strings and changes no value. Turn it into CSV appears for a list of two or more objects with the same flat keys and no number too long to keep exactly. Remove extra spaces and blank lines keeps each line’s indentation, appears for text that is not JSON or CSV, and is offered when it saves at least 5% of the text. Each shows the characters it saves, exactly, and about how many tokens; a saving under 16 characters is not shown. In Simple mode a note appears when a prompt is over 2,000 tokens or has more than 50 lines. In Composer one appears when one of two or more sections is over 40% of the tokens, or when the Examples section is over 500 tokens.
Source: CalcTrail’s own rules and thresholds; no publisher.
Sources
- OpenAI. Key concepts, section "Tokens". Undated page, read October 5, 2026.
- Anthropic. Glossary, entry "Tokens". Undated page, read October 5, 2026.
- Anthropic. Pricing, section "Additional notes": the tokenizer of Claude 4.7 and later. Undated page, read October 5, 2026.
- Google. Understand and count tokens, its opening section on tokens. Undated page, read October 5, 2026.
- Anthropic. Token counting, its notes on the newer tokenizer and on estimates. Undated page, read October 5, 2026.
- OpenAI. tiktoken, tiktoken/model.py, the model-to-encoding map. Main branch, read October 7, 2026.
What this calculator does not cover
- Its estimates run no provider’s tokenizer. The exact GPT-5 count runs OpenAI’s, when you ask. No result is a billed count.
- It does not count images, video, PDFs or tool definitions, which providers also count in tokens.
- A provider’s count can include tokens the provider adds itself; Anthropic does not bill those.
- The Claude row is Claude 4.7 and later. It does not model the older tokenizer of Claude 4.6 and earlier.
- The text ratios are for English prose, and JSON and CSV have their own. A ratio is an average: numbers-heavy data takes more tokens than it says, and code, other languages and emoji can too.
Sources checked on .