About Tonl
TONL, short for Token Optimized Notation Language, is a text first serialization format designed to be friendly to large language models. It represents the same data as JSON using fewer tokens, which the site puts at 32 to 50 percent fewer in typical cases and up to 60 percent in its best examples, lowering API costs for prompts and responses. It is a zero dependency TypeScript library with a command line tool, installed globally through npm.
The format uses a compact header style such as users[2]{id,name}, with optional type hints like u32, str and bool that add a small token overhead but enable schema validation, TypeScript generation and better model understanding. An optimization suite offers ten strategies, including dictionary, delta, run length encoding, bit packing, column reordering and a tokenizer aware mode, with automatic strategy selection. A query API supports JSONPath like lookups, and the site cites constant time index lookups.
The interactive command, tonl stats with an interactive flag, shows token analysis and compares JSON and TONL side by side. Users can switch between tokenizers for GPT 5, Claude Sonnet 4.5, Gemini 2.5 Pro, Gemini 3 Pro and Llama 4, and choose display themes. The site also provides documentation and an online playground.
It suits developers who pass structured data to LLMs at volume. The library is open source and the site publishes no pricing.