Running on your device · 0 bytes uploaded

OpenAI tokenizer playground

Count tokens exactly with the encoding a model actually uses — every token id and slice listed, both directions, computed in a worker.

Direction
Text
GPT-5.x, GPT-4.1, GPT-4o, o-series (current models) · 400 tokens listed, count always exact
Result

Paste text (or ids), then press Count.

What counts as exact
  • Counts are the BPE output of the installed gpt-tokenizer encoding — a port of OpenAI's tiktoken. Exact for these encodings: what the matching OpenAI models charge for is what is counted.
  • Claude, Gemini, and other vendors use different tokenizers. Counts here are NOT their counts — the context-fit tool labels those as estimates instead of pretending.
  • Special tokens pasted into the text (like <|endoftext|>) count as their single special id — that is what a model actually receives.
  • A token can hold partial UTF-8 (an emoji often splits); its slice may show the replacement character. That is the real boundary, not a bug.
Samples
  • Ordinary English — watch spaces lead most tokens.

  • Astral emoji and CJK carry multi-byte tokens; one grapheme is not one token.

  • Code tokens split on punctuation runs — why code costs more tokens than prose.

  • A pasted special token counts as its single special id — what the model actually sees.

Nothing in yet

Paste, drop, or type to begin. Everything stays on this device.

nothing counts until you press Count