AI Token Counter

Count tokens in pasted text for supported GPT model encodings, directly in your browser.

Count tokens in text

Tokenizer: o200k_base.

Counts automatically after you pause typing. Up to 100,000 text units. Some emoji and other characters use two units.

Your text stays in this browser tab. Tokenizer data downloads on first use.

Tokens in your text

Paste text above or choose an example.

Text tokens only. Complete API input can include message formatting, tools and other context. This does not predict future output.

Method & examplesReviewed · Sources

Paste text and choose an encoding

Paste or type text and choose a supported model or tokenizer. The count updates after a short pause. Clear empties the text; Text example and Code example fill and count examples. Copy result includes the token count, selected model, tokenizer and scope, without your text. If the clipboard is unavailable, select the copyable result manually.

GPT-5, GPT-4.1 and GPT-4o use o200k_base here. GPT-4 and GPT-3.5 Turbo use cl100k_base. You can also select either encoding directly. These are explicit compatible mappings, checked on October 24, 2026, rather than a list of available or newest models. An unlisted model may require a different encoding.

Method and example

A tokenizer splits text into token IDs using a vocabulary and byte-pair encoding rules. The count is the number of IDs produced by js-tiktoken 1.0.21 for the selected encoding. hello world produces 2 tokens in both supported encodings. Tokens are not the same as words or characters; whitespace, punctuation, language and emoji can change the count.

Whitespace in the displayed text is counted. Strings such as <|endoftext|> are counted as ordinary text, without interpreting special tokens. A browser textarea normalizes pasted CRLF line endings to LF; the count applies to the text displayed in the field, not the original bytes of a file.

What the count includes

The result counts tokens in your text. Complete API input can additionally include message formatting, system instructions, tools, images and other context. Hidden app context and future output are not measured. This tool does not call a model, estimate a bill or predict the output length.

Privacy, downloads and limits

Counting runs in a browser worker. Text is not sent to a server, added to a URL or saved in browser storage. Reloading the page clears it. Model names and text remain in this tab; Copy result writes only count metadata and valid enabled budget values to your clipboard when requested; it excludes your text.

Tokenizer code and dictionaries download from this site’s own origin when you first count nonempty text. These are sizeable downloads; changing to another encoding can require another dictionary. No API key or network fallback for counting is used.

The browser processing limit is 100,000 UTF-16 code units: most common characters use one unit, while some emoji and other characters use two. Longer text is rejected visibly and is never shortened silently. Empty text counts as zero after editing or clearing; spaces are counted. A count taking longer than 15 seconds stops with a retry action. Changing text or encoding cancels active work. Real-device performance may vary.

Check a manual token budget

Enable Check a manual token budget, enter a context limit from 1 to 1,000,000,000 and an output reserve from 0 to 1,000,000,000 whole tokens. These are your values, not built-in model context sizes. Remaining tokens = limit − current text count − output reserve. For a count of 1,000, a limit of 8,000 and reserve of 2,000 leave 5,000. A negative remainder shows the exact overflow.

Text plus reserve is shown as a percentage rounded HALF_UP to two decimals; ≈ marks rounding. The bar stops at 100%, while the text keeps the full percentage and overflow. Changing budget fields does not count the text again. Invalid budget values keep the text and count, but hide budget results and Copy until fixed or disabled. Disabling the budget keeps its drafts.

This budget excludes message formatting, tools, hidden context and other API overhead. It cannot guarantee that a complete request fits or predict future output. Copy includes valid enabled budget values and this limitation, without the pasted text.

Third-party tokenizer and dictionary notices.

Sources and model

Method version 2.0.0. Reviewed .

Maintained by Aleksandr Pervukhin. Report a calculation error.