Skip to main content

TOML Formatter + Converter — TOML 1.0, ↔ JSON, ↔ YAML, line-numbered errors

TOML formatter + converter — format/validate TOML 1.0, convert TOML ↔ JSON ↔ YAML, with error line/column.

  • Runs locally
  • Category Developer & DevOps
  • Best for Formatting, validating, shrinking, or inspecting code-adjacent text.
Indent
Arrays
Examples:
Input (TOML)
Output (TOML)
Output appears here once you paste valid input.

What this tool does

A real TOML 1.0 tool for the configs you actually paste — Cargo.toml, pyproject.toml, netlify.toml, Hugo's `config.toml`, multi-env database blocks, Discord/Telegram bot configs. Format with 2 or 4 spaces (or tab), force arrays onto one line or many, sort table keys for diff stability, and convert the parsed tree into JSON or YAML — or take JSON / YAML and emit clean TOML. The parser handles every TOML 1.0 surface: dotted keys, array-of-tables `[[products]]`, inline tables, basic + literal strings (single and triple-quoted), `\u` escapes, integer prefixes `0x` / `0o` / `0b` with underscore separators, `inf` / `-inf` / `nan`, RFC 3339 datetimes including local time and local date. Syntax errors come with a line number, a column number, and three lines of context with a `^` caret under the offending character — same UX as a real compiler. 100% client-side: nothing leaves the browser tab, safe for `Cargo.toml` secrets, internal Helm-adjacent configs, or staging DB strings.

Tool details

Input
Text + Numbers
The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
Output
Live result + Copy
The result area focuses on usable output, with copy, download, or preview actions when supported.
Privacy
Browser-side processing
The main tool logic does not call an external API, so inputs normally stay in the current tab.
Save / share
Shareable URL state
Key settings are encoded in the URL so another person can reopen the same setup.
Performance budget
Initial JS <= 35 KB
No WASM budget is declared, keeping the tool quick to open on mobile.
Best fit
Developer & DevOps · Developer
Category and role tags drive related tools, internal links, and quick fit checks.

How to use

  1. 1. Input

    Paste or drop your content into the tool panel.

  2. 2. Process

    Click the button. All processing is local in your browser.

  3. 3. Copy / Download

    Copy the result or download to disk in one click.

How TOML Formatter + Converter fits into your work

Use it in the small gaps between coding, reviewing, debugging, and shipping.

Developer jobs

  • Formatting, validating, shrinking, or inspecting code-adjacent text.
  • Preparing snippets for documentation, tickets, commits, or handoff.
  • Checking a small payload quickly without switching tools.

Developer checks

  • Run irreversible transforms like minify or obfuscate on a copy.
  • Keep secrets out of pasted snippets unless the tool explicitly stays local.
  • Use your normal tests or linter before shipping transformed code.

Good next steps

These links move the current task into a more complete workflow.

  1. 1 JSON to TypeScript Interface JSON to TypeScript interface — paste JSON, get clean interfaces with union types from arrays, optional vs required detection, root name customizable. Open
  2. 2 YAML Formatter & Validator Format and beautify YAML — re-indent, validate, minify, sort keys. Open
  3. 3 JSON Formatter & Validator Format, validate, and minify JSON instantly — right in your browser. Open

Real-world use cases

  • Bring a noisy `Cargo.toml` into shape before committing

    You added three new dependencies during a debugging session and your `Cargo.toml` now mixes 2-space and 4-space blocks, with one `features = ["serde", "tokio", "reqwest", "rustls"]` line stretching to column 95. Paste it here, click "Format TOML", toggle "Sort keys A→Z" so `[dependencies]` lands alphabetized for your team's CI lint. Copy back. The diff against `main` now only shows the actual three additions instead of 40 lines of whitespace churn.

  • Pull a config out of `pyproject.toml` into JSON for a Python script

    You're writing a script that reads project metadata (`[project] name`, `version`, `dependencies`) and the rest of your tooling speaks JSON. Paste `pyproject.toml`, switch to "TOML → JSON", copy. Now your `meta = json.loads(open(...).read())` gets the same shape as `[project]` without you having to add `tomllib` or remember Python 3.11's stdlib oddities.

  • Convert a YAML CI config to TOML for a Rust tool

    You have a `.github/workflows/build.yml` you want to port the job matrix from into a Cargo-side `xtask/config.toml`. Paste the YAML block, switch to "YAML → TOML", copy. The output uses `[[matrix]]` array-of-tables for each job, and your `xtask` binary picks it up with `toml::from_str` — same job matrix, same source of truth, two configs.

  • Debug a `netlify.toml` that fails the build with no good error

    Netlify's build error is "TOML parse error at line ?? col ??" with no context. Paste your `netlify.toml`, you get the exact line, column, AND three lines of context with a `^` under the offending character. Usually it's an unquoted value with a colon (`status = 301 force` instead of `force = true`) or a missing `]` in a `[[redirects]]` header. Fix in 5 seconds, push.

  • Multi-environment DB config sync across staging and prod

    You keep `[default]`, `[development]`, `[staging]`, `[production]` blocks in one `db.toml`. You want to make sure `staging` and `production` differ ONLY in `host` and `pool_size`. Format both files with "Sort keys A→Z", diff with `git diff --no-index`, you see exactly the intentional differences — nothing snuck in because someone hand-edited the file.

  • Generate a Discord/Telegram bot config block from a JSON template

    You have a JSON-shaped bot config you're prototyping, but the target runtime (Rust serenity, Python aiogram with a TOML extension) wants TOML. Paste the JSON, switch to "JSON → TOML", copy into `config.toml`. The `[[commands]]` array of objects becomes `[[commands]]` array-of-tables — exactly the form the framework's `serde` derives expect.

Common pitfalls

  • Pasting a `.env` file as TOML and watching it fail. `.env` allows `KEY=value` without quoting; TOML requires quotes around any string with spaces or special chars. Wrap each value in quotes (`KEY="value"`) and it'll parse.

  • Expecting `inf` / `nan` to survive the TOML → JSON conversion. JSON forbids both, so we flatten them to `null` with a note in the FAQ. If your value is genuinely `nan`, the right fix is upstream — that's almost always a math bug, not a serialization gap.

  • Trying to keep comments after a re-format. The parser intentionally drops comments because preserving them across a re-emit is a 3x-larger parser for a feature most workflows don't use (Prettier's TOML mode does the same). Use git diff to see the actual content change.

  • Treating dotted keys as nesting in JSON output. TOML's `a.b.c = 1` is identical to `[a.b] c = 1` — the JSON output is `{a: {b: {c: 1}}}` either way. There is no separate flat-with-dots JSON form.

  • Pasting JSON with a root array and expecting TOML. TOML requires a table (object) at the root. Wrap your array in `{ "items": [...] }` first; the converter will then emit `[[items]]` array-of-tables.

  • Expecting sort-keys to reorder array elements. Sort-keys only sorts table KEYS — `[[products]]` array elements and `[1, 3, 2]` array values stay in source order because TOML semantics treat array order as data.

Privacy

Your TOML / JSON / YAML stays in the browser. The input textarea is intentionally NOT written to the URL — only your option choices (direction, indent, array style, sort-keys) sync via `useUrlState`. That means a "Share settings" link reproduces the workflow for a teammate, but they paste their own config — yours never travels. The parser, serializer, and three-way converter run on `requestIdleCallback`-light JavaScript inside the tab; there is no network call, no analytics on textarea content, no localStorage write. Safe for `Cargo.toml` with internal crate registry tokens, `pyproject.toml` with private PyPI URLs, staging / production DB configs, and any other config that should never end up in a Slack paste or a browser history entry.

FAQ

Tool combos

Folks in your role tend to reach for these alongside this tool.

Made by Toolora · 100% client-side · Updated 2026-06-14