Skip to main content
C
CodeUtil

TOML Formatter

Format TOML files and convert between TOML and JSON formats with instant validation.

Loading tool...

Why I Switched to TOML (Mostly)

YAML indentation bugs cost me a Friday night once. A single misplaced space broke a Kubernetes deployment. That's when I started reaching for TOML whenever I could. It's explicit, it supports comments (unlike JSON), and you can't accidentally break it with whitespace. This formatter helps me validate TOML files and convert between TOML and JSON when I need to.

What This Tool Does

  • TOML to JSON - When your API wants JSON but your config is TOML
  • JSON to TOML - Convert those JSON configs to something more readable
  • Format TOML - Standardize formatting across your team
  • Validation - Catch syntax errors before deployment
  • Indentation Options - 2 or 4 spaces for JSON output
  • Copy & Share - Quick sharing with colleagues

I pair this with the JSON Formatter for further processing and the YAML Converter when I'm stuck in YAML-land.

Why I Like TOML

TOML (Tom's Obvious Minimal Language) was created by Tom Preston-Werner, GitHub's co-founder. After dealing with YAML gotchas for years, I appreciate TOML's straightforward approach:

What Makes TOML Nice to Work With

  • Human-readable - No squinting at indentation levels
  • Typed values - Strings, integers, floats, booleans, dates - all explicit
  • Tables - Clean nested structures using [section] headers
  • Arrays - Both inline and table arrays, whichever fits better
  • Comments - Because sometimes you need to explain why

My Take on TOML vs YAML vs JSON

I use all three, but for different things:

  • TOML - My default for config files. Explicit, no indentation surprises
  • YAML - When the ecosystem demands it (Kubernetes, GitHub Actions). I'm careful with indentation
  • JSON - API payloads, package.json, anywhere machines need to read it

TOML wins for application config because you can't accidentally break it with a space, and you can add comments to explain non-obvious settings.

TOML Files I Work With Regularly

  • Cargo.toml - Rust projects (the format's biggest adopter)
  • pyproject.toml - Python projects with modern tooling
  • config.toml - Application settings I need to document
  • netlify.toml - Deployment configs
  • hugo.toml - Static site configs

TOML Syntax I Reference

# This is a comment
title = "My App"
version = "1.0.0"

[database]
host = "localhost"
port = 5432
enabled = true

[servers.alpha]
ip = "10.0.0.1"

[[products]]
name = "Hammer"
price = 9.99

[[products]]
name = "Nail"
price = 0.05

Related Articles

Frequently Asked Questions

Is my TOML data secure?

Yes. Everything processes in your browser - I don't see your config files, and they never leave your device. Privacy was a core requirement when I built this.

Why are comments lost during conversion?

JSON doesn't support comments (one of its biggest limitations, in my opinion). When you convert TOML to JSON, comments have nowhere to go. If you need them, keep a TOML version as your source of truth.

Can I format Cargo.toml files?

Absolutely! I use this for Rust projects all the time. Paste your Cargo.toml, validate the syntax, catch any errors before cargo gets upset.

What TOML version is supported?

TOML 1.0, the stable spec. All the standard features work - inline tables, arrays of tables, datetime values, the works.