TOON Formatter
Format and beautify your TOON (Token-Oriented Object Notation) files
Input TOON
Formatted TOON
Paste your TOON on the left and the result shows up here.
Or drop a file on this box, , or .
What is TOON Formatter?
Got messy or unformatted TOON (Token-Oriented Object Notation) data? This tool formats and beautifies your TOON files with proper indentation and structure. Perfect for making TOON data readable, maintainable, and easier to work with. TOON is a data serialization format designed for LLM applications.
Proper formatting improves readability while maintaining token efficiency. Our formatter decodes your TOON, validates it, and re-encodes it with consistent indentation (2 spaces) and proper structure. This makes it easier to review, debug, and maintain your TOON files. Similar to JSON, TOON provides structured data representation optimized for Large Language Models.
Formatting here also doubles as a strict check, because the decoder refuses input that a lenient reader would guess at: a header that promises users[3] over two rows fails with Expected 3 tabular rows, but got 2, and a tab used for indentation is rejected outright. When that happens, the TOON Validator is the better place to work through the errors, and TOON to JSON shows you what the data looks like once it does parse.
What Makes This Tool Different
Consistent Indentation
Formats TOON with proper 2-space indentation. Nested structures are clearly visible, making it easy to understand the data hierarchy.
Syntax Validation
While formatting, we also validate your TOON. Invalid syntax? We'll show you exactly what's wrong so you can fix it.
Preserves Data
Values come through unchanged, including integers longer than JavaScript can hold, which are written back with every digit. Only layout changes: indentation, and number spelling like 1.0 becoming 1.
Formats As You Type
Formatting happens as you type. No waiting, no server delays – pure browser-side processing.
File Upload Support
Got a TOON file? Just upload it. Works with .toon and .txt files. No need to copy-paste – just drag and drop or click upload.
Download Formatted
One click to download your formatted TOON as a .toon file. Perfect for saving beautified versions or sharing with your team.
How It Works
Paste or Upload TOON
Paste TOON on the left, or open a saved file with Upload (.toon and .txt are accepted). The Sample button gives you a users[3] table, three people with id, name and role columns, already in canonical layout. Indent nested blocks with two spaces; input indented with four is read as having no rows and fails.
Automatic Formatting
As soon as you paste, the formatter processes your TOON and displays the beautifully formatted version on the right. Nested structures get proper indentation, and everything is aligned perfectly.
Copy or Download
"Copy" puts the tidied TOON on your clipboard, and "Download" gives you a .toon file instead. The formatted TOON maintains token efficiency while being much more readable.
When You'd Actually Use This
Code Review
Reviewing TOON files in code reviews? Formatting makes it easier to spot issues, understand structure, and verify data correctness. Much easier than reading unformatted TOON.
Debugging
Trying to find issues in your TOON data? Formatting reveals the structure clearly, making it easier to spot syntax errors, incorrect nesting, or data problems.
Documentation
Creating documentation with TOON examples? Formatted TOON is much easier to read and understand. Perfect for tutorials, API docs, or team documentation.
Learning TOON
Write TOON by hand the way you think it works, then see how the encoder would write it. Quotes you did not need disappear, so tags[2]: rush,"net 30" comes back as tags[2]: rush,net 30, and a number like 1.50 is shortened to 1.5. Comparing the two is a quick lesson in what the format actually requires.
Common Questions
Is my TOON data stored?
No. Decoding and re-encoding use the @toon-format/toon library, loaded into this tab; the TOON is not posted anywhere or kept after you leave. Because TOON decodes to the same data model as JSON, the formatted text holds exactly the values you pasted.
What indentation does it use?
We use 2 spaces for indentation, which is the standard for TOON format. This makes nested structures easy to read without taking up too much space.
Can I format invalid TOON?
No. If the decoder rejects the input, the output pane is left empty and a red message names the problem and its line, such as a tab character used to indent line 2. Fix that line and the formatted text comes back on the next pause. The TOON Validator is handier when there are several problems to work through.
Does formatting change my data?
No values change. The formatter decodes your TOON and encodes it again with two-space indentation, so layout is normalised and a number like 1.50 is written as 1.5. Long IDs such as 8901240544102066246 keep every digit.
How big can my TOON file be?
There is no fixed cap. The text is decoded and encoded again a moment after you stop typing, so the cost is two passes over the file. A prompt-sized document of a few hundred rows is done before you notice; for exports in the tens of megabytes, paste once and Download the result rather than editing in the pane.
Does formatting affect token count?
A little. Indentation is whitespace, and tokenizers do count it, but two-space indentation is what TOON uses anyway, and the big savings come from writing keys once per table rather than from spacing. If every token matters, compare the formatted and unformatted text in your model's tokenizer.
Other TOON Tools You Might Need
Formatted TOON is usually headed into a prompt or out to another format; these pages cover converting it to JSON, CSV, XML, YAML or TOML, or producing TOON from JSON in the first place.
Related resources: npm for the TOON library.