YAML formatter and validator

Paste a YAML file to tidy its indentation and catch mistakes such as tabs, duplicate keys and broken lists. The formatter handles a documented subset of YAML and tells you when something is outside it.

Indent

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Paste YAML into the left box.
  2. Choose 2 or 4 spaces. Optionally tick Sort keys A–Z.
  3. Copy the result. If the file is invalid, you see the line and column of the first problem.

What it checks

  • Tabs used for indentation (YAML allows spaces only).
  • Lines that do not line up with their siblings.
  • Duplicate keys in one mapping.
  • A plain value that contains : , such as a: b: c.
  • Quotes, brackets and block scalar headers that are broken.
  • Anchors, aliases, tags and multi-line values, which are outside the supported subset.

What it changes

Indentation becomes uniform, key: value becomes key: value, lists under a key are indented one level, and [ a,b ] becomes [a, b]. Block scalars keep their text and move to the new indentation. A blank line you left between entries is kept, as one line. Sorting orders the keys of every mapping by their text and moves each key together with its comments; the order of list items is never changed.

Example

server:
    host: a.example
    ports: [ 80,443 ]

becomes

server:
  host: a.example
  ports: [80, 443]

Tips

Quote values that contain : or start with a special character. In a block scalar, indent every line at least as far as the first one. The output has no final newline; add one if your tool expects it.

Frequently asked questions

Which parts of YAML does this support?

Block mappings and sequences, plain and quoted single-line scalars, one-line flow collections written with [ ] or { }, block scalars with | and >, comments, and several documents separated by ---.

What is not supported?

Anchors (&), aliases (*), tags (!), merge keys (<<), complex keys (? ), and plain, quoted or flow values that continue over several lines. These produce an error with the line and column instead of being guessed.

Does the formatter change my values?

No. Scalars are copied exactly as written, so yes, no, 007 and "quoted" keep their form. Only indentation, spacing after colons and dashes, and the spacing inside one-line flow collections change.

What happens to my comments?

Comments on their own lines stay above the entry that follows them, and a comment at the end of a line stays on that line. A comment that sits after the last item of a block, right before a less indented key, moves to just above that key.

Does passing this check mean every YAML parser accepts the file?

Not necessarily. It checks structure within the supported subset, such as indentation, tabs and duplicate keys. It does not check what the values mean for your application.

More in Developer

All tools in this category: Developer ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.