Free tool

YAML Formatter that Keeps Comments, Anchors and Number Text

A config file is one space out and nothing starts. Paste the YAML here to see a mistake with its line and column, tidy the layout, or look at the same data as JSON or a tree. Indentation rules were read from the YAML 1.2.2 specification on 22 October 2026.

Input
Result

The formatted YAML shows here.

Paste on the left, open a file, or press Example.

Options

Keys

  • Cmd Enter Format
  • Cmd Shift Enter Flow style
  • Cmd S Download
  • Cmd Shift C Copy
  • / Search

Your YAML is read by your own browser and never uploaded or saved, so secrets inside config files stay with you. Only your formatting choices are remembered on this device.

Why one space can break a whole file

YAML uses indentation to show structure, so a line moved by one space can change which key it belongs to, or make the file unreadable. The YAML 1.2.2 specification, revised on 1 October 2021, says indentation is made of spaces and that tab characters must not be used for it. Children must sit deeper than their parent, and siblings must line up. Source: YAML 1.2.2 specification, read 22 October 2026.

If a file came from an editor that inserted tabs, the error message here will point to the line. Paste it in and the marker shows exactly where the structure stops making sense.

What the formatter leaves alone

Tidying a file should not change what it means, so the formatter is careful with several things.

  • Comments are kept unless you untick Keep comments.
  • Blank lines are kept unless you untick Keep blank lines.
  • Anchors, aliases and tags stay as written, and so does the way each text value was quoted.
  • Numbers keep their written form. A value like 0755, 1.50 or 0x1F is printed back exactly, rather than turning into 755, 1.5 or 31, which could change how a tool reads a file mode or a version string.
  • Several documents separated by three dashes stay as separate documents.

When sorting keys A to Z, maps that hold an anchor are left in order, so an alias is never placed above the thing it points to.

The options in one table

OptionChoices
Indent2 or 4 spaces
Line width80 characters, 120 characters or no wrapping
YAML version1.2 (current) or 1.1 for older tools
Lists and mappingsAs written, or block style with one item per line
Other switchesSort keys, keep comments, keep blank lines, indent lists under their key, spaces inside brackets

The version choice is there for older tools that still follow the 1.1 rules. If a deployment tool is that old, pick 1.1 and check the output against it.

Seeing the same data three other ways

The Result tabs are YAML, JSON and Tree. The JSON tab is useful when you must send the same settings to a service that wants JSON, and several YAML documents become one JSON list. The Tree tab folds the structure and lets you click a key to copy its path or value. Merge keys are expanded in the JSON and Tree views only, so you can see the final values without changing the YAML.

Choose Flow style (minified) for a compact one line per document with comments dropped. If you paste JSON in, it comes out as block style YAML, which makes the tool a quick converter in that direction too. The JSON formatter handles the other direction in more depth.

When a settings file turns into a site problem

A bad config file often shows up as a failed build or a missing page after an update. Fixing the file is the small part. Finding out why it changed is the real job, and it sits inside our Webflow maintenance work and similar care plans, where we look at the cause and not only the symptom.

Before you format a file that a deployment tool reads, keep the original. Formatting is safe by design, but a changed line width or a block style can make a review diff look large even when the meaning is the same. Sorting keys is the option most likely to surprise a team, since some files rely on the order in which things are written.

When the check passes here and the real tool still complains, the cause is usually a rule of that tool, such as a required key, and not YAML itself.

Frequently asked questions

How do I validate YAML?

Type or paste the YAML on the left. With Check as I type on, any mistake is shown with its line and column and the line is marked.

Can YAML use tabs?

Not for indentation. The specification says tabs must not be used there, so use spaces.

Does it remove my comments?

Not unless you turn off Keep comments, or use Flow style, which drops them.

Will 0755 or 1.50 be changed?

No. Numbers are printed back exactly as you wrote them, so file modes and version numbers are not altered.

Can I convert YAML to JSON?

Yes, use the JSON tab. Several documents separated by three dashes become one list.

Is my YAML sent anywhere?

No. It is processed in your browser and not stored.

More free tools

  • JSON formatter: Format, minify, validate and repair JSON, browse it as a tree, or convert it to YAML or CSV.
  • XML formatter: Indent, minify and check XML, repair common slips, or turn it into JSON.
  • Diff checker: Compare two texts or files side by side, merge changes and export a diff.
  • JSON to CSV converter: Turn JSON into CSV or Excel with nested fields as columns, and CSV back into JSON.
  • Regex tester: Test a JavaScript regex with live matches, groups, a replace preview and an explanation.