AI JSON Token Counter

Estimate the LLM token count of a JSON payload for context budgeting.

  • 100% client-side · your data never leaves your browser
  • Instant, no rate limits
  • Free, no sign-up
Input JSON
Token estimate

Your result appears here

Paste JSON into the panel on the left — everything runs privately in your browser.

Overview

JSON Token Counter — Estimate LLM Tokens for JSON

Estimate how many tokens a JSON payload will use before you send it to an LLM like ChatGPT, Claude, or Gemini. JsonDrift compares the minified and formatted forms, shows characters and bytes, and tells you how many tokens minifying saves — so you can budget context windows and trim payloads. Everything runs in your browser.

No uploadsNo sign-upOpen source
  1. Why count tokens in JSON?

    LLMs bill and limit by tokens, and JSON is verbose — braces, quotes, and repeated keys all cost tokens. When you stuff API responses or documents into a prompt, it's easy to blow past the context window or run up cost. A quick estimate tells you whether a payload fits and where the weight is.

  2. How the estimate works

    The counter uses the common rule of thumb that one token is roughly four characters for English-and-JSON text, blended with a word-based estimate for a more stable number. It reports tokens for both the minified and formatted versions alongside exact character and byte counts.

  3. Minify to save tokens

    Pretty-printed JSON adds indentation and newlines that a model still pays for. The tool shows how many tokens you save by minifying — often 10-30% — which is free budget you can spend on more data or a longer response. For large payloads, also consider removing nulls and empty fields with the JSON Cleaner first.

  4. About accuracy

    This is an estimate, not exact tokenizer output. Real tokenizers (OpenAI's tiktoken, Anthropic's tokenizer) split text differently and will vary by roughly 10-20%, especially for non-English text, long numbers, or unusual symbols. Use the estimate to compare payloads and budget context, and verify with the provider's tokenizer when you need an exact count.

FAQ

Frequently asked questions

How many tokens is my JSON?

Paste your JSON and the tool estimates the token count for both minified and formatted forms, along with character and byte sizes.

How accurate is the estimate?

It's a heuristic (about four characters per token) and will differ from a real tokenizer by roughly 10-20%. Use it for budgeting and comparisons, not exact billing.

Does minifying JSON reduce tokens?

Yes. Removing indentation and newlines typically cuts 10-30% of tokens; the tool shows the exact savings for your payload.

Is my JSON uploaded?

No. The estimate is computed locally in your browser, so your data never leaves your machine.

Continue with a related tool

All tools

Learn more in our guides

All guides