What is TOML?
TOML stands for Tom's Obvious, Minimal Language. It is a configuration-file format designed to make structured settings easy for people to read and write. TOML uses straightforward key-value pairs, table headers, arrays, strings, numbers, Boolean values, and date and time values. Its syntax is defined by a published specification.
TOML is commonly encountered in software projects and configuration
workflows. Files such as Cargo.toml and
pyproject.toml use TOML to describe project metadata,
dependencies, build settings, and development-tool configuration.
Other applications use TOML for their own settings.
A TOML formatter makes an existing document more consistent and easier to review. It can normalize spacing around equals signs, tidy array layout, align comments, and apply consistent newline preferences. The aim is readable TOML—not to invent configuration values or decide whether a setting is correct for a particular application.
How to format TOML online
-
Paste or open a file.
Enter TOML text in the input area, or select a local
.tomlfile using Open .toml file. - Choose formatting preferences. Select the indentation style, preferred line width, and line-ending convention. Decide whether eligible keys should be alphabetically sorted.
- Format the document. Click Format TOML to run the formatter. Valid TOML is rewritten using the selected formatting settings.
- Inspect the result. Review the formatted text and check the status message. A syntax error is reported instead of silently treating invalid input as formatted output.
-
Copy or download.
Copy the result to your clipboard or download it as a
.tomlfile for use in your project.
You can also select Check syntax to see whether the formatter can process the current TOML without replacing the current output. Syntax checking is useful before saving a configuration change, but it is not a substitute for an application's own configuration validation.
TOML formatter features
Consistent spacing and indentation
Normalize spacing around assignments, table definitions, and values so configuration files are easier to scan and review.
Readable arrays
Set a preferred column width and choose whether long arrays should expand across lines or short arrays should collapse to a compact layout.
Comment alignment
Align consecutive inline comments to make configuration notes easier to compare while reviewing TOML entries.
Key ordering option
Choose to alphabetically reorder eligible keys when a consistent order helps you maintain a configuration file. Key sorting is optional rather than automatic.
Syntax error feedback
The formatting engine processes TOML syntax and reports errors when it cannot format a document. A successful format does not prove that every application-specific setting is supported.
Copy and download
Copy formatted text or download a local TOML file without requiring an account or an upload to an encoding service.
Example: before and after TOML formatting
The following example has inconsistent spacing around assignments and a compact dependency table. Formatting makes the layout more consistent and easier to read.
Before formatting
# Example project configuration
[package]
name="sample-app"
version = "1.0.0"
edition="2021"
[dependencies]
serde={version="1.0",features=["derive"]}
tokio={version="1.0", features=["full"]}
After formatting
# Example project configuration
[package]
name = "sample-app"
version = "1.0.0"
edition = "2021"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.0", features = ["full"] }
Exact output layout depends on the formatter and selected options. For example, an inline table may be expanded by a formatter setting. Always review the output before committing it to your project.
Which TOML files can you format?
Cargo.toml files
Rust projects use Cargo.toml for package metadata,
dependency declarations, features, and other Cargo settings.
Consistent formatting makes dependency changes and project metadata
easier to read during code review.
pyproject.toml files
Python tools use pyproject.toml for project metadata,
build-system requirements, tool configuration, and other supported
settings. A formatter helps keep the document readable, but it
cannot determine whether a selected backend or tool accepts every setting.
Application and developer configuration
You can also format TOML used by static-site tools, command-line applications, package managers, and other software. The formatter handles syntax-level layout; the application that reads the file remains responsible for interpreting and validating its settings.
Best practices when formatting TOML
- Review changes before committing. Use a version-control diff after formatting, especially if a file contains important configuration or is shared by a team.
- Be cautious with key sorting. Alphabetical ordering can make some files more consistent, but preserving existing order may make changes easier to review. Sorting should be an intentional choice.
- Use the expected newline style. Choose LF for most Unix-like workflows or CRLF when the project explicitly requires Windows-style line endings.
- Do not confuse formatting with validation. A formatter checks whether the input can be formatted according to its syntax rules. It does not check dependency availability, accepted option names, application versions, or security policy.
- Protect sensitive configuration. Formatting runs in the browser on this page. Avoid using a browser or device you do not trust for confidential configuration.
Frequently asked questions
What does a TOML formatter do?
A TOML formatter rewrites valid TOML using consistent formatting rules. Depending on its options, it can normalize spacing, adjust array layout, align comments, apply line endings, and make configuration files easier to read.
How do I format TOML online for free?
Paste TOML into the input box or open a local TOML file. Choose indentation and other formatting preferences, select Format TOML, then copy or download the result. No account is required.
Can this tool format Cargo.toml and pyproject.toml?
It can format TOML content from these files when the syntax is supported by the formatter. It does not validate that dependency versions, build backends, package names, or tool-specific settings are correct for Cargo, Python, or any other application.
Does formatting change my TOML values?
A proper formatter aims to alter presentation rather than the intended configuration values. Even so, review the output and compare it with the original before using it in production. Formatting does not test an application’s interpretation of the file.
Are TOML comments preserved?
The page uses the Taplo formatter, which formats TOML source rather than rebuilding the document from a plain JavaScript object. Comment formatting can be adjusted with the comment-alignment option. Review the output if comments or unusual formatting are important to your project.
Can I validate TOML syntax with this tool?
Yes. Check syntax asks the formatter to process the input and reports whether it can parse and format it. This is a syntax-level check, not validation against an application-specific schema.
Is TOML the same as JSON, YAML, or INI?
No. TOML has its own grammar, value types, arrays, tables, and date-time syntax. JSON, YAML, and INI have different rules. Do not format TOML with a JSON or YAML formatter; use a TOML-aware formatter such as this one.
Is my TOML uploaded to a server?
The page runs the formatting operation in your browser and does not send the TOML text to our server for formatting. The first visit loads the formatting engine from a third-party CDN. Avoid entering confidential settings on a device or browser you do not trust.
Why does the TOML formatter show an error?
Errors may be caused by a missing value, an invalid string escape, an incorrectly written table header, duplicate keys, or malformed arrays. Check the diagnostic, correct the original input, and format it again. A formatter does not fix every syntax error automatically.