cd /news/large-language-models/accurate-local-claude-4-7-tokenizer · home topics large-language-models article
[ARTICLE · art-96210] src=tokenize.rs ↗ pub= topic=large-language-models verified=true sentiment=· neutral

Accurate local Claude 4.7+ tokenizer

Sanderland's open-source ctok tool reconstructs Anthropic's Claude tokenizer, estimating 49,152 vocabulary entries in Claude 3 and 16,384 in Claude 4.7, with some reserved for image tokens. Claude 5's tokenizer has a vocabulary about 12 times smaller than OpenAI's o200k, resulting in 1.24x to 2.44x larger token counts on samples, and since Claude Opus 5 and GPT-5.6 Sol both charge $5 per million input tokens, the token ratio equals the cost ratio.

read1 min views1 publishedAug 14, 2026
[ctok on GitHub ↗](https://github.com/sanderland/ctok)
[Read the write-up ↗](/claude-tokenizer)

Claude publishes no tokenizer. count_tokens

hands back a number, one round trip at a time, and nothing about where it came from. ctok returns the same number offline, and the pieces behind it.

Our best estimate of the vocabularies: 49,152 entries in v3, a third of that in v4.7 at 16,384, with some of both reserved for image tokens.

Markers ride inside the piece they belong to: word edges, capitals, and raw bytes where the vocabulary has no piece for a character.

The write-up goes through them.

The cost of a small vocabulary #

Claude 5's tokenizer comes at a cost, but less than its size suggests. Its vocabulary is about 12× smaller than o200k, while its token bill is 1.24× to 2.44× larger on these samples. Common pieces do most of the compression; a larger vocabulary spends the rest on rarer words and scripts.

Claude Opus 5 and GPT-5.6 Sol both charge $5 per million input tokens, so the token ratio is the cost ratio.

── more in #large-language-models 4 stories · sorted by recency
── more on @sanderland 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/accurate-local-claud…] indexed:0 read:1min 2026-08-14 ·