Key Features of the TOML Formatter
- **One-click beautifier** for TOML configuration files and snippets
- **Configurable indent size** from 1 to 8 spaces via the *Indent Size* slider
- **Indent style toggle** – choose between spaces or tabs for indentation
- **Wrap / Line Length** control to keep long arrays and inline tables within a chosen column width
- Supports `.toml` files such as `pyproject.toml`, `Cargo.toml`, `Pipfile.toml`, `poetry.toml` and more
- Prettier-based TOML parser that understands dates, arrays, nested tables and inline tables
- Stable, idempotent formatting – rerunning it on the same file won’t cause formatting drift
- One-click copy of the formatted output, ready for your editor or commit
🛠️ How to Format TOML Files Online for toml-formatter
1. Paste or Upload Your TOML
📥 Paste TOML into the editor or drag-and-drop a `.toml` file such as `pyproject.toml` or `Cargo.toml`. The tool parses the content as TOML, not generic INI/JSON.
2. Choose Indentation & Wrap Settings
⚙️ Use the **Indent Size** slider to choose how many spaces per indent level, and switch **Indent Style** to tabs if your project prefers them. Adjust **Wrap / Line Length** to control when long arrays or inline tables should wrap (or set it to `0` to effectively disable wrapping).
3. Click “Format”
🚀 Hit the **Format** button. The formatter will reflow arrays, clean up spacing around `=` and commas, normalize table spacing, and enforce consistent line breaks while preserving your data.
4. Review, Copy or Save
🔍 Compare the original and formatted TOML. When you’re happy, copy the result back into your editor or save it as a new `.toml` file in your project.
Technical Specifications
Supported TOML Features
The formatter is built for real-world project configs and understands modern TOML constructs.
| Feature | Support | Examples / Notes |
|---|---|---|
| Tables & subtables | ✅ Full | [tool.poetry], [project], [database.replica] |
| Arrays | ✅ Full | Inline arrays and arrays of tables |
| Inline tables | ✅ Full | servers = { alpha = "10.0.0.1", beta = "10.0.0.2" } |
| Dates & times | ✅ Full | 2025-09-23T10:20:30Z and local date formats |
| Comments | ✅ Preserved | # comments stay near the settings they describe |
| Multiline strings | ✅ Full | Triple-quoted TOML strings for long text blocks |
Formatting Options (Mapped to Tool Controls)
These options are exposed directly in the UI and wired to the underlying Prettier TOML plugin:
| Option | UI Control | Range / Values | Default |
|---|---|---|---|
| Indent size | Indent Size slider | 1–8 spaces | 2 spaces |
| Indent style | Indent Style select | Spaces / Tabs | Spaces |
| Line length | Wrap / Line Length | 0–120 columns (0 = effectively no wrap) | 80 columns |
| End-of-line | End of line (internally) | LF / CRLF | LF in browser output |
Input & Limits
The tool is optimized for small to medium TOML files commonly found in application repos.
| Parameter | Value / Behavior | Notes |
|---|---|---|
| File extensions | .toml | Any TOML-based config file |
| MIME types | application/toml, text/x-toml | Used for file detection in the dropzone |
| Max file size | ~5 MB | Larger files may be slower and are better handled in CI |
| Max characters | ≈ 2,000,000 | Hard limit in the formatter runtime to avoid browser lockups |
Validation & Error Handling
If your file isn’t valid TOML (e.g. missing `=` or mismatched quotes), the formatter will typically return a readable error instead of formatted output. Fix the indicated line and run the formatter again.
Command Line Alternatives for TOML Formatting
Love the result and want the same style in CI or pre-commit hooks? Here are CLI-friendly options:
Cross-platform (Node.js / Prettier)
Install Prettier and the TOML plugin
npm install --save-dev prettier prettier-plugin-tomlAdds Prettier and the TOML parser to your project.
Format a TOML file with Prettier
npx prettier --parser toml --write pyproject.tomlRewrites `pyproject.toml` in place using Prettier’s TOML rules.
Linux / macOS / Windows (Taplo CLI)
Format TOML using Taplo
taplo fmt pyproject.tomlAnother popular CLI formatter for TOML files.
Check formatting in CI
taplo fmt --check .Fail the build if TOML files are not properly formatted.
Common TOML Formatter Use Cases
Python Packaging (`pyproject.toml`)
Keep Python project metadata and tooling configuration clean and easy to review.
- Align `[project]`, `[tool.poetry]` and `[tool.black]` sections.
- Normalize dependency arrays and version specifiers.
- Make config diffs easier to read in pull requests.
[project]
name = "my-app"
version = "0.1.0"
[tool.black]
line-length = 88
include = "\.(py|pyi)$"
Rust Projects (`Cargo.toml`)
Tidy Rust package manifests across workspaces and microservices.
- Keep `[dependencies]` and `[dev-dependencies]` sorted and consistently spaced.
- Normalize inline tables used for complex feature flags.
- Standardize formatting across multiple crates in a workspace.
[package]
name = "my-crate"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
Static Sites & Tools (Hugo, Zola, etc.)
Clean TOML used for static-site generators and miscellaneous tooling.
- Format `config.toml` for Hugo or other static site generators.
- Keep multilingual configuration blocks readable.
- Normalize long lists such as menu entries and taxonomies.
❓ Frequently Asked Questions
❓What is a TOML formatter?
📏How should I choose indent size and style?
🧪Does the formatter validate TOML syntax?
🔁Can running the formatter change my configuration behavior?
🔒Is it safe to format sensitive config files?
Pro Tips
Keep a nicely formatted `pyproject.toml` or `Cargo.toml` in your main branch, then enforce the same style in CI using Prettier or Taplo.
Format TOML before committing large dependency or config changes so your Git diffs focus on **actual changes**, not whitespace noise.
When refactoring configs, format the file first, commit, then change the values. This makes it easier to review what really changed.
Use the same **indent size** and **wrap length** across all your TOML files to make cross-project navigation and code reviews feel consistent.
Additional Resources
Other Tools
- CSS Beautifier
- HTML Beautifier
- Javascript Beautifier
- PHP Beautifier
- Color Picker
- Sprite Extractor
- Base64 Decoder
- Base64 Encoder
- Csharp Formatter
- Csv Formatter
- Dockerfile Formatter
- Elm Formatter
- ENV Formatter
- Go Formatter
- Graphql Formatter
- Hcl Formatter
- INI Formatter
- JSON Formatter
- Latex Formatter
- Markdown Formatter
- Objectivec Formatter
- Php Formatter
- Proto Formatter
- Python Formatter
- Ruby Formatter
- Rust Formatter
- Scala Formatter
- Shell Script Formatter
- SQL Formatter
- SVG Formatter
- Swift Formatter
- Typescript Formatter
- XML Formatter
- YAML Formatter
- Yarn Formatter
- CSS Minifier
- Html Minifier
- Javascript Minifier
- JSON Minifier
- XML Minifier
- Http Headers Viewer
- PDF To Text
- Regex Tester
- Serp Rank Checker
- Whois Lookup