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 anywhereWhen 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
Citations Viewer
Paste a Claude Citations API response to see the answer text with each cited passage highlighted and matched to its source document, location, and quoted text.
Signature Validator
Getting a 400 error or silently broken multi-turn tool use from the Gemini 3 API? Paste your request or response to check function-calling turns for missing thoughtSignature fields, functionResponse ordering mistakes, and missing id echoes.
MCP Validator
Paste a Model Context Protocol tool definition β a single tool object, an array, or a full tools/list response β to check it against the spec: missing name or inputSchema, a name most clients will reject, a required property that doesn't exist, malformed annotations, and more.
Embedding Truncator
Truncate a Matryoshka-style embedding vector to fewer dimensions and correctly L2-renormalize it β the step most people skip when truncating OpenAI, Gemini, Cohere, or Nomic embeddings by hand.
Bracketly is free and open-source. If this tool saved you time, consider supporting it.
β Buy me a coffee