Token counter

Count plain-text tokens with o200k_base or cl100k_base. See token boundaries, copy IDs and download JSON with every token.

Privacy: runs in your browser

This tool processes your input in this browser. Inputs and results are excluded from analytics. Draft saving is optional and stays on this device; delete saved text with the draft controls. Loading text from a URL is optional and contacts that server; its URL and your IP address are visible to the server. When a button sends your result to another tool, it waits in this tab until that tool opens it, for up to a minute, and is then deleted.

Copy link includes the inputs you choose to share in the address. Anyone with that link can reopen them. Files and generated results are excluded. Password and key tools share settings only.

Counts plain text using the selected encoding. Chat roles, tools, images and message wrappers add tokens outside this count.

Your token count

See token boundaries and IDs

␠ is a space, ↵ a line break, and ⇥ a tab. A token can split a Unicode character; � in a piece does not change the original bytes. Hover a piece for its ID and bytes.

More
Keyboard shortcuts

Sharing and starting over

A copied link includes what you entered and your settings, so anyone with it can see them. Leave private text out. Files and results are not included; random draws are made again.

Start over puts the tool back to its starting values and closes any open file or device. Drafts you saved stay on this device until you delete them.

What this token count includes

Choose the exact encoding required by your application. The tokenizer splits your text into UTF-8 byte pieces and merges them using the selected vocabulary. Whitespace, capitalization and punctuation can change the tokens even when the words look similar.

The count covers only the pasted text. It excludes chat roles, system wrappers, tools, images, audio and other request overhead. Encoding names are shown directly so a changing model name does not silently select the wrong vocabulary.

Open the token details to inspect boundaries and IDs. Exported token IDs reconstruct the UTF-8 bytes of the text; the tool checks that match before enabling export. Special-token-looking strings are counted as ordinary text.

Next: Character counter

Worked example

“hello world” is 2 tokens in both encodings, but the IDs differ: cl100k_base gives [15339, 1917] and o200k_base gives [24912, 2375].

Next: Word counter

Before you rely on the result

This is not a billed API-usage count or a context-window guarantee. It supports the two named base encodings only. Tokens may split a Unicode character; an individual preview piece can show a replacement symbol even when the combined bytes are exact. Isolated invalid UTF-16 surrogates normalize to the replacement character.

Cite this page

ToolOctopus. “Token counter.” Updated . https://tooloctopus.com/token-counter.

Add an access date if your instructions require one.

Citation formatting uses citeproc-js by Frank Bennett and Citation Style Language styles. License and source code.

Find a tool

Type a task, a unit pair, a sum or a time zone. ↓ to choose, Enter to open.