Paste or drop
Text, or a JSONL, CSV or text file; files are counted per row and in total.
Models
Token counts decide context limits, cost and fine-tuning length. Paste text or drop a file and see the count for cl100k (GPT-4, GPT-3.5) and o200k (GPT-4o and later) tokenizers, with each token coloured in place so you can see how a script or a code snippet is split, and a cost estimate at a price per million tokens you set.
Loading the tool…
Text, or a JSONL, CSV or text file; files are counted per row and in total.
Tokens are shown as coloured segments; hover for the id. Whitespace and Devanagari or Arabic script expand noticeably.
Set input and output prices per million tokens and the tool prices a request, a batch or a dataset epoch.
cl100k_base for GPT-4 and GPT-3.5, o200k_base for GPT-4o and o-series. Llama, Mistral and Gemma use SentencePiece tokenizers with different counts; a Llama-3 option is planned.
English prose is about 1.3 tokens per word; code about 1 token per 3 characters; Hindi and Urdu 3-5x English per word.
Each message adds a few tokens of formatting; the chat mode adds them so counts match the API.
No. The tokenizer tables are bundled and run locally.
Message framing tokens and the special tokens the API adds; use chat mode.
Drop the JSONL; the total and per-row histogram are shown.