AI Token & Context Calculator
NEWCount tokens with a selected tokenizer, inspect how text is split, and plan the full context of an AI request: instructions, history, retrieved documents, tools and reserved output, with every estimate labelled.
Context planner
Every part of one request
- Tokens
- Characters (UTF-16)
- Code points
- Visible characters
- Words
- UTF-8 bytes
- Lines
- Bytes per token
Selecting a token shows its ID, its bytes and its place in the text.
- {n} of {total}
- Token ID
- Bytes
- {from} to {to}
- Characters
- Text
- Tokens
- Characters (UTF-16)
- Code points
- Visible characters
- Words
- UTF-8 bytes
- Lines
- Bytes per token
Selecting a token shows its ID, its bytes and its place in the text.
- {n} of {total}
- Token ID
- Bytes
- {from} to {to}
- Characters
- Text
Each component is counted once. Tool results already kept in the conversation history belong to the history only; chat formatting tokens added by a provider are not included.
Found a bug or missing something? Write to us
Scope and limits
Verified tokenizer, stated limits
Checked token for token against the official tokenizer
The tokenizer is tested against OpenAI's tiktoken on multilingual text, emoji, code, JSON, whitespace and a large input. The plan is tested against reference cases: 1,200 + 4,500 + 12,000 + 800 + 1,500 input tokens and 4,096 reserved output give 24,096 of 32,768 tokens, 73.54%, with 8,672 left.
Help
FAQ
Which tokenizers are used, and how exact are the counts?
o200k_base and cl100k_base, the encodings of OpenAI models, implemented in the page and checked token for token against OpenAI's tiktoken. For a model documented to use one of them the count is exact. For a model whose tokenizer is not published, the count is labelled as an estimate with the tokenizer used.
Why do tokens, characters and bytes differ?
A token is a run of UTF-8 bytes. A Latin letter takes 1 byte, a Polish letter 2, a Japanese character 3 and an emoji 4. The emoji 😀 is 2 UTF-16 characters, 1 code point, 1 visible character and 4 bytes, and a token can end in the middle of it; such a token is shown as bytes.
What is the difference between the context window and the maximum output?
The window is shared by input and output; the maximum output is a separate limit. With a 32,768-token window and a 4,096-token maximum output, 10,000 input tokens and 8,000 reserved output tokens fit the window (18,000), yet the output exceeds its maximum by 3,904. Each limit is therefore checked on its own.
Why is <|endoftext|> counted as several tokens?
Strings that look like special tokens are counted as ordinary text, the way message content is sent through an API. A control token is never created from pasted text, and the page says when such a string is present.
Does the count include chat formatting?
No. Providers add tokens for message roles and formatting, and the amount differs between models and APIs. The planner counts the components as entered or tokenized and states that this overhead is not added.
Is the text sent to a server?
No. The tokenizer table is downloaded once and checked by SHA-256 before use; the text is tokenized in the browser. The share link and the JSON export carry counts and limits only, never text and never token IDs, from which text could be rebuilt.
