Inspect
Formatter Validator Convert
TOML→JSON JSON→TOML TOML→YAML YAML→TOML INI→TOML TOML→INI .env→TOML TOML→.env TOML→TS Transform
Sort keys Flatten Minify Compare
Diff Merge
TOML Sorter
Sort every table's keys alphabetically and re-emit canonical TOML. Use it to make diffs reproducible, to find a key quickly in a long file, or to enforce a house style. Comments are dropped.
— S., [email protected]
canonical TOML 1.0 output
In this page
Why sort keys
TOML doesn't care about key order within a table, but humans and version control systems do. Sorting alphabetically gives you:
- Reproducible diffs. Two contributors editing the same file in different orders produce identical output.
- Quick lookup. Finding a setting in a 500-line config becomes a binary-search problem.
- House-style enforcement. Pair this with a pre-commit hook to keep configs tidy.
How to use it
- Paste TOML on the left, click Sort.
- Every table — including nested and arrays-of-tables — has its keys re-emitted alphabetically.
- Copy or download the result.
Notes
- Comments are stripped. Re-emission goes through the parsed value tree, which doesn't carry comments.
- Array values keep their order. Only object/table keys are reordered.
- The output is canonical TOML 1.0. Quoting and spacing get normalized as a side effect.
FAQ
Will it move [package] before [dependencies]?
Yes — top-level table headers are sorted alongside everything else. If you depend on a specific section order for documentation, sort selectively rather than globally.
Does case matter?
Yes. Uppercase letters sort before lowercase in ASCII order. Keep your casing consistent for predictable results.