← All tools
GPT
AI

GPT Token Counter

Count tokens for GPT-5, GPT-4o, and older OpenAI models as you type, using the exact same tokenizer OpenAI's API uses. 100% client-side β€” your text is never sent anywhere.

πŸ”’ Runs entirely in your browser β€” no data is ever sent anywhere

0
Tokens
0
Characters
0
Words

When you need a GPT token counter

OpenAI's API bills by token, not by character or word, and most models also enforce a hard context-window limit measured in tokens β€” so before sending a long prompt (a big document for summarization, a lengthy system prompt, a large few-shot example set) it's worth knowing exactly how many tokens it costs and whether it fits, rather than finding out from a truncated response or a failed request. This tool counts as you type, live, which also makes it easy to compare the token cost of two different phrasings of the same prompt.

Why the same text costs different tokens on different models

This uses js-tiktoken, the same byte-pair-encoding tokenizer library OpenAI's own API uses internally, with the identical vocabulary files β€” so for a plain text prompt, the count here matches exactly what you'd be billed. It automatically picks the right tokenizer for the model you select: o200k_base for the GPT-5 and GPT-4o families plus the o-series reasoning models, or cl100k_base for GPT-4, GPT-4 Turbo, GPT-3.5 Turbo, and the text-embedding-3 models. o200k_base's larger 200k-entry vocabulary packs non-English scripts and common multi-word phrases more efficiently than cl100k_base's 100k, so identical text can tokenize to noticeably fewer tokens depending which family you're targeting β€” which is exactly why token count isn't simply proportional to character or word count.

Frequently asked questions

Which models does this cover?

Two tokenizers, chosen automatically from the model you pick: o200k_base for the GPT-5 and GPT-4o families plus the o-series reasoning models, and cl100k_base for GPT-4, GPT-4 Turbo, GPT-3.5 Turbo, and the text-embedding-3 models. It does not cover Claude, Gemini, or other non-OpenAI models β€” their tokenizers aren't compatible with tiktoken.

Is this the exact same count the OpenAI API would bill me for?

For a plain text prompt, yes β€” this uses js-tiktoken, the same byte-pair-encoding tokenizer OpenAI's own tiktoken library uses, with the identical vocabulary files. Chat-format requests add a small fixed per-message overhead on top of the raw text tokens (for role/name formatting), which this tool doesn't add since it only tokenizes the raw text you paste.

Why do the same words cost different token counts in different models?

o200k_base (GPT-5/GPT-4o) uses a larger 200k-word vocabulary than cl100k_base's 100k, which packs non-English scripts and common multi-word phrases more efficiently β€” the same sentence can tokenize to noticeably fewer tokens under o200k_base, especially for non-Latin scripts.

Why did the page pause briefly when I opened it?

The tokenizer's vocabulary file (roughly 1–2 MB depending on the model) loads on demand the first time you use this tool or switch model families, so it's cached in your browser tab from then on rather than bundled into every page on the site.

Related AI tools

Bracketly is free and open-source. If this tool saved you time, consider supporting it.

β˜• Buy me a coffee