JSON Token Counter
Count exact JSON grammar tokens and get a transparent, model-dependent estimate for LLM prompt tokens. Everything runs locally.
How to use it
- Paste strict JSON, drop a local file, or select Load Example.
- Select Count Tokens or press Ctrl/⌘ + Enter.
- Use the exact grammar count for JSON structure and the estimate range for rough LLM planning.
- Use your model provider’s tokenizer before enforcing a hard context or billing limit.
JSON tokens versus LLM tokens
A JSON grammar token is a syntax unit defined by the data format. Braces, brackets, commas, colons, property-name strings, values, booleans, numbers, and null each contribute to that count. Cryonel calculates this structural total exactly after parsing the document. It is useful for comparing JSON shapes, but it is not the same measurement used by a language model.
An LLM tokenizer breaks text into model-specific pieces. A familiar word may be one token, while an uncommon identifier, escaped string, number, or punctuation sequence may use several. Different models can tokenize the same JSON differently, so a model-independent web page cannot honestly promise one exact total.
How the estimate works
The displayed estimate uses roughly four Unicode characters per token and shows a wider range based on three to five characters per token. This common heuristic is suitable for early prompt sizing, not for quota enforcement or billing calculations. The report states that limitation directly instead of presenting an approximate number as exact.
The tool also estimates the minified document. Removing indentation and line breaks can reduce tokens when formatting whitespace is part of the submitted prompt. The saving depends on the tokenizer, and minifying does not change repeated keys or long values. Keep readable JSON during development when clarity matters, then measure the exact request form used in production.
When exact counting matters
Use the tokenizer supplied for the exact deployed model before rejecting input, splitting documents, calculating cost, or approaching a context-window limit. Tokenizers and model versions can change, and chat APIs may add tokens for message structure or tool definitions that are not visible in the pasted JSON. Count the entire final request, not only one embedded payload.
For rough architecture decisions, the range is often enough. It can reveal that a verbose payload is obviously too large, compare two response shapes, or show whether minification is worth testing. If the estimate sits close to a hard limit, switch to the official tokenizer rather than adding a smaller safety margin to an uncertain number.
Common uses
- Estimate JSON payload size before adding it to an LLM prompt.
- Compare original and minified prompt forms.
- Review how repeated object keys affect a structured context.
- Document a rough token budget during prototyping.
- Count exact JSON grammar units for parser and fixture discussions.
Security and privacy
Parsing and counting happen entirely in the current browser tab. Cryonel does not upload the JSON or token report. The browser still holds the pasted prompt in memory, so avoid sharing copied reports that contain sensitive source values.
Frequently Asked Questions
Is the LLM token count exact?
No. Exact token counts depend on the selected model and tokenizer. Cryonel provides a transparent character-based estimate and range.
What is a JSON grammar token?
It is a JSON syntax unit such as a brace, comma, colon, string, number, boolean, or null value. This count is exact but differs from LLM tokens.
Does the counter upload my prompt?
No. JSON parsing and every count run in the current browser tab.