On the Biology of Claude's Tokenizer - by Sander Land
Token Contributions
SubscribeSign in
On the Biology of Claude's Tokenizer<br>Explaining how Claude's mysterious tokenizer seems to work
Sander Land<br>Jul 29, 2026
12
Share
Claude's tokenizer remains a mystery, and with the recent 40%+ increase in token cost for basic English text, even more so. While everyone else ships a fairly standard byte-level BPE tokenizer, Anthropic seems to have placed their bets on something unique.<br>In this post I'll go through the most interesting properties I've found while reconstructing Claude's tokenizer.<br>Code is available here: https://github.com/sanderland/ctok<br>Thanks for reading Token Contributions! Subscribe for free to receive new posts and support my work.
Subscribe
Claude’s tokenizer is not BPE
A pairwise BPE construction requires every non-base token to be built from two smaller vocabulary pieces, so a one-token span must have at least one internal split into two things that are themselves tokens. That’s testable.<br>The Hangul syllable 최 (choi) is the first example I found. It is one token (which makes sense, a very common surname), but testing other Korean syllables which share a common UTF-8 prefix/suffix shows the 2-byte prefix and suffix are not tokens in any other character (i.e. all characters sharing a prefix or suffix cost 3, their length in bytes).<br>So what is it? The one rule that seems to consistently explain the token counts is a minimum-piece tokenization as in MinGram or PathPiece.<br>Vocabulary size
My best estimate of vocabulary size is around 49-55k for Claude v3-v4.6 and around 16-20k after, based on the list of tokens found so far.<br>Boundary markers and spaces
Boundary markers on words
One of the main novelties of the Claude tokenizer is wrapping word-like spans in boundary markers. I use ^ and $ as notation for these inferred begin- and end-of-word tokens. For example, “tokenizers” becomes [^token][izers$]<br>For example “semiconduct”, “usercontent” are two tokens and “romagnet” is three tokens in isolation, but the tokens here are [^semiconduct][$], [^][usercontent$] and [^][romagnet][$], that is, the phrases are tokens but just in the right context. And indeed, “semiconductromagnetusercontent” tokenizes to the expected three tokens.<br>Similarly, “telecommunications” is a single token, but “telecommunicationsy” is four ([^telecommun][ic][ation][sy$])<br>This also clarifies the conclusion of my previous post, where I suggested that most Claude tokens were whole words. What was really being measured was whether the fully marked form (^word$) was a one-token vocabulary entry.<br>Boundary markers on punctuation
Spans of punctuation characters also get markers, but only on the side where they border a space, e.g. the punctuation in a== b becomes ==$<br>Boundary markers eat spaces
At first sight, these markers may seem a little wasteful of vocabulary space, but this is compensated for by not needing different variants for word-with-a-space and word-without-a-space.<br>Specifically, I think that any space in $^ is removed before encoding, and $^ becomes a space during decoding. This means that many whitespaces in code and normal text are “free”, and most of all, the model doesn’t split its training data between “space prefixed” and “non space” variants.<br>CapsCode
Another relative novelty is how capitalization is handled. Much like space+word being a separate token feels redundant, so does having duplicate tokens for nasa, Nasa, and NASA.<br>For title-case and all-caps, Claude appears to use a shift marker or caps marker and then a lowercased form:<br>Token → ↑ token<br>NASA → ⇪ nasaThe marker itself can be part of a token, or be separate (just like ^ and $).<br>Notably, it only applies to a whole pretoken, not for every capital letter. Thus:<br>Token → marked ↑ token<br>NASA → marked ⇪ nasa<br>GaN → literal GaN<br>WiFi → literal WiFiThus, while MERCHANTABILITY is a single token [⇪^merchantability$], adding a lowercase letter “q” breaks both the caps-code and word marking, turning it into [^M][ER][C][H][A][N][T][A][B][I][L][I][T][Y][q$].<br>The newer v4.7+ tokenizer has simplified this a lot, and removes the caps-lock code.<br>Whitespace
There are tokens for spans of spaces, newlines and tabs. Weirdly, 1,2,…,30,32,33,40,48,64,98,128 newlines are tokens, but 31 is not.<br>Message overhead
There appears to be a fixed overhead of 7-8 tokens, such that “a” costs 8, but a single digit cost 9 tokens.<br>However, closer investigation suggests this is due to the surrounding chat formatting beginning with ^ and ending in \n\n (along with some other unknown content). In particular the ^ start can really lead to some puzzling results when trying to find out what is a token and what is not.<br>Odds and Ends
Han, Korean, emoji and many rare scripts do not have word markers, and are always tokenized character-by-character.
For characters that don’t have a dedicated token, UTF-8 byte fallback is used, but only within a character, and strictly prefix-based (e.g....