Configuration formatting

TOML formatterKeep comments with your configuration

Format the current document, or validate and navigate tables without rewriting it.

TOML formatter

Current TOML

Format reads this document and writes it back after a successful check. Pasting, typing, and changing indentation, width, line endings or sorting do not rewrite it. Validation and table navigation are read-only.

Ctrl/Cmd+Enter: FormatShift+Ctrl/Cmd+Enter: Validate

Enter TOML or choose an example.

Formatting options

Sorting is off by default. Contiguous key groups are sorted; attached comments follow keys while group headings stay in place. Arrays and table order stay unchanged.

TOML 1.0.0 · dprint TOML 0.8.0 · toml-eslint-parser 1.0.3. Syntax validation does not check application schemas.

The first input allows 500,000 UTF-16 units and 2 MB UTF-8, with 50,000 nodes and depth 100. A generated document can continue up to 2 million characters. Each task has 5 seconds.

Original

Content stays in this browser. Input is not uploaded, executed, saved or added to a URL. Undo and redo cover edits, formatting, the example, clearing, restoring the original and opening a file. Options are not history steps.

A TOML formatter should make configuration easier to read without erasing the notes beside it. Format checks this document and writes it back. Validation and table navigation stay read-only.

Use the TOML beautifier for readable project settings, or the TOML validator when you only need a syntax check. When you format TOML online, tables, repeated array tables and multiline text need a real parser rather than a line-by-line rewrite.

Why use this TOML formatter

Readable configuration with its explanations intact

Keep the notes beside the settings

The TOML formatter retains standalone and trailing comments instead of discarding them during object serialization. Optional sorting moves an entry’s leading notes with that entry; blank-line-separated groups keep their own headings.

Colored comment markers remain attached to their matching configuration entries after the entries are neatly aligned.

Find actual tables in long files

Navigation lists each real table header in the current document, including repeated array-table instances, with its line and column. A bracketed line inside a triple-quoted string is data, so it never becomes a false navigation target.

A navigation rail connects to real table sections while a bracket-like shape inside a multiline text block is excluded.

Format the current document

Three controls that stay explicit

01

Format writes this document back

Format parses the current text and, after the preservation check, replaces it. Indentation, width, line endings and key sorting apply only to that next format. Pasting or changing an option does not rewrite the document. Ctrl/Cmd+Enter formats; Shift adds validation.

02

Validation follows the current text

Validate checks syntax and lists real table headers without changing the document. Click a header or the reported error to move to that line in the current text. Repeated array tables stay separate. The list shows 50 headers at a time and never truncates a download.

03

Example, clear and files start a document

Example, Clear and a local UTF-8 file replace the editor immediately and can be undone. The original is captured before the first successful format. Copy and Download always export the full current document, including text you edited by hand.

Formatting with visible decisions

Control presentation while keeping TOML data types

Comment-aware output

A syntax-tree formatter handles comments, quoted keys, multiline strings and inline tables. A preservation guard compares parsed values and comment content before accepting output; failures stop the operation rather than exposing a partial file.

Scoped key sorting

Keep the original order by default, or sort contiguous key groups separated by blank lines. Attached leading and trailing comments move with their entries. Array elements, inline-table keys, ordinary table order and array-table instance order are not reordered.

Indentation and line endings

Choose two spaces, four spaces or tabs, a preferred width of 80, 100 or 120 columns, and LF or CRLF output. Width is a layout preference, not a guarantee that every string or comment fits. String values retain their content even when layout changes.

Copy and download the current document

Formatting runs in a cancellable browser worker with a five-second limit. Copy and the UTF-8 download use the full current document, including later edits. A failed format leaves the text in place and does not add a success step.

Syntax, preservation and work limits

Know what a successful check actually establishes

TOML 1.0.0 is the declared contract
Parsing uses toml-eslint-parser 1.0.3 with TOML 1.0.0 selected. Formatting uses dprint TOML 0.8.0. Do not assume TOML 1.1-only syntax is accepted. Duplicate keys and invalid syntax stop at the first diagnostic, with an input line and column; this is not an exhaustive error list.
No object-to-text reconstruction
Comments and TOML values are retained, including large integers, dates and times, multiline strings and non-finite floats. Formatting changes presentation, so it does not promise identical bytes or blank-line placement. If a preservation check cannot establish safe output, the operation fails. Trailing whitespace in comments may be trimmed. Comments are ordinary text: they do not control formatting or trigger schema loading.
Sorting has deliberate boundaries
Sorting operates within key groups and keeps comment attachment. A standalone heading separated by a blank line stays at the top of its group. It does not sort tables, array-table instances, array elements or inline-table keys, and it does not apply Cargo-specific conventions.
Syntax is not an application schema
A syntactically valid pyproject.toml or Cargo.toml may still contain unknown fields, invalid dependency constraints or wrong value types for its application. No remote schema, dependency resolution, build check, automatic repair or duplicate-key deletion is performed.
Local text and one file at a time
Accepts pasted content or one UTF-8 file. LF and CRLF are supported; a bare CR is not a valid TOML 1.0 line break. There is no URL import, sharing link, saved input history, directory batch processing or automatic overwrite of the original file. Format conversion belongs to separate tools.
Bounded processing
The first input must fit 500,000 UTF-16 units and 2 MB UTF-8, with at most 50,000 nodes and depth 100. Output is capped at 2 million characters, and a generated document may continue inside that budget. Each worker task has five seconds. Invalid Unicode, syntax, limits or guard failures keep the current text.

TOML formatter questions

Comments, specification and project files

Does formatting also check syntax?

Yes. The TOML formatter parses the current document before formatting and checks preservation before writing it back. Validate only checks syntax and does not change the text. Copy and download always use the current document. An error stays visible with a clickable location.

What TOML specification does it accept?

This page explicitly accepts TOML 1.0.0 through toml-eslint-parser 1.0.3 and formats with dprint TOML 0.8.0. The version is visible beside the options. Newer TOML 1.1 syntax is outside the declared contract even if another tool accepts it.

Will comments survive formatting?

Yes, accepted output retains comment content. Unlike converting to a plain object and serializing it again, this TOML formatter uses a syntax-tree formatter and a preservation guard. Sorting can move a comment with its key, while whitespace and blank-line layout may change.

Does this work with Python and Rust project files?

It can format TOML 1.0 syntax in pyproject.toml and Cargo.toml within the documented limits, preserving their values and comments. It does not validate Python packaging metadata, Rust dependencies or application schemas, and Cargo formatting conventions are disabled.

Can I format without uploading configuration?

Processing runs locally in a browser worker. The page loads its formatting engine as a site asset; your source is not included in that request. The TOML formatter creates a new download only when you request it, leaving your original file untouched.

Found a comment or table layout we should check?

Try the TOML formatter

Use the TOML formatter to tidy comments, table locations and optional key sorting in the current document. Validation does not rewrite it.

Syntax success does not replace your project’s own validation.