Token counter
Count tokens in text or a file with real GPT-4o, GPT-4 and legacy Claude tokenizers that run in your browser, plus characters, words and a coloured token view.
Questions
Which tokenizers are exact?
The GPT-4o (o200k_base) and GPT-4 (cl100k_base) tokenizers are OpenAI's encodings from tiktoken, so counts are exact for models that use them. The Claude legacy tokenizer is the one Anthropic published for older Claude models; current Claude models use a newer tokenizer that is not public, so treat that count as an estimate.
Why does the estimate differ from the real count?
The estimate assumes about 4 characters per token, which holds roughly for English prose. Code, numbers, emoji and many other languages use more tokens per character, so pick a real tokenizer when it matters.
Do special tokens count?
No. Counts are for your text only, without the start or end markers or the message wrapping an API adds around it.
Is my text uploaded?
No. Tokenizing happens in a worker in this tab. Only the tokenizer files are downloaded, from HelpyTools itself.