JSON token tool

JSON Token Counter

Paste a JSON payload, compare token counts, and see how formatting or minification changes the result.

Editable sample

Compare JSON token counts

Use valid JSON, then format or minify it before running the same payload through seven local tokenizers.

Characters
113
Lines
6
Initial benchmark result

Tokenizer files load only after you run a comparison. Your text stays in this browser.

TokenizerTokensTokens / 100 charactersDifference from OpenAI Current
OpenAI Currento200k_base3732.7Same as baseline
OpenAI Legacycl100k_base3732.7Same as baseline
Gemma 3Pinned SentencePiece model4539.8+8 (+21.6%)
DeepSeek V4 ProPinned tokenizer JSON4035.4+3 (+8.1%)
Qwen 3.5Pinned tokenizer JSON4338.1+6 (+16.2%)
Mistral Medium 3.5Pinned tokenizer JSON4237.2+5 (+13.5%)
Llama 3Pinned tokenizer JSON3732.7Same as baseline
What is counted

JSON text, without request wrappers

The result includes every key, value, quote, comma, brace, space, and line break in the editor. It does not include the surrounding API message, tool schema, or provider-specific formatting.

Compare ordinary text in the multi-tokenizer comparison, or inspect individual token boundaries in the token counter.

View tokenizer sources
How StackLens verifies data and calculates cost

OpenAI Legacy tokenizer sourceHigh confidenceChecked 2026-07-19

JSON is encoded locally with cl100k_base; no chat or API wrapper tokens are added.

Gemma 3 tokenizer sourceHigh confidenceChecked 2026-07-19

JSON is encoded locally with Pinned SentencePiece model; no chat or API wrapper tokens are added.

DeepSeek V4 Pro tokenizer sourceHigh confidenceChecked 2026-07-19

JSON is encoded locally with Pinned tokenizer JSON; no chat or API wrapper tokens are added.

Qwen 3.5 tokenizer sourceHigh confidenceChecked 2026-07-19

JSON is encoded locally with Pinned tokenizer JSON; no chat or API wrapper tokens are added.

Llama 3 tokenizer sourceMedium confidenceChecked 2026-07-19

JSON is encoded locally with Pinned tokenizer JSON; no chat or API wrapper tokens are added.

FAQ

JSON token counter questions

Does JSON formatting change token count?

It can. Spaces, indentation, and line breaks are part of the encoded text. Use the format and minify controls to compare both representations.

Is my JSON uploaded?

No. JSON parsing and tokenization run in your browser. Do not paste secrets into any online tool even when local processing is available.

Does the counter include API message wrappers?

No. It counts the exact JSON string in the editor. Chat roles, tool definitions, and provider request formatting are not included.

Can I compare invalid JSON?

The page requires valid JSON before running the comparison so formatting mistakes are not mistaken for payload data.