YAML Validator & Formatter

Check YAML, find the line of the error and tidy the indentation.

Result

# A small config
name: Superwebkit
private: true
tools:
  - id: 1
    free: true
  - id: 2
    free: true
tags: [ json, yaml ]
9 lines · 126 bytes
  • Valid YAML (1 document). Comments are kept; indentation and spacing are normalized.

What does a YAML validator do?

YAML relies on spacing, so a small slip, like a tab, a missing colon or a wrong indent, can break a whole file. Programs often report these errors poorly. A validator checks the file and tells you where the problem is.

This tool also re-formats valid YAML with the indent you choose, and keeps your comments. It counts the documents, so a file with --- separators is reported as several. The sample config is valid, with one document, and its inline list of tags is rewritten with spaces inside the brackets.

How to use the YAML Validator & Formatter

  1. Paste your YAML on the left.
  2. Choose a 2 or 4 space indent.
  3. Read the tidied YAML, or the error with its line and column.
  4. Copy or download the result.

Real situations

When people use the YAML Validator & Formatter

  • 1

    Check a CI or Kubernetes file

    Catch indentation mistakes before you push, instead of waiting for a pipeline to fail.

  • 2

    Tidy a messy config

    Normalize the spacing of a file edited by many people, while keeping the comments.

  • 3

    Find a tab or a bad indent

    The error names the line and column and shows a caret, such as for a tab used as indentation.

  • 4

    Check multi-document files

    See how many documents a file holds, for example several manifests in one file.

Good to know

  • Fix the first error shown, then check again.
  • Use spaces for indentation. Tabs are not allowed.
  • The note says how many documents the text contains.

FAQ

YAML Validator & Formatter: questions answered

Why is my YAML invalid?

Typical causes are a tab used for indentation, a missing colon, mixed indentation and unclosed quotes or brackets. A tab, for example, gives the message Tabs are not allowed as indentation with the line and column.

Does formatting keep my comments?

Yes. Comments are kept, while indentation and spacing are normalized. This is different from converting to JSON, which drops comments.

How does it handle several documents?

A file can hold several YAML documents separated by ---. The tool validates each one, tells you how many there are and prints them with the separator between them.

What YAML version does it follow?

YAML 1.2. In that version only true and false are booleans, so values like yes and no stay as text.

Will formatting change the meaning of my file?

It should not. Only whitespace and layout are normalized, so tags: [json, yaml] is written as tags: [ json, yaml ]. Still, review important files, such as deployment settings, before using them.

How is this different from the YAML to JSON converter?

The converter changes YAML into JSON and drops comments. The validator keeps the file as YAML, checks it, tidies the indentation and keeps comments. Use it when the file stays YAML.

Is this YAML Validator & Formatter free and private?

Yes. It is free with no sign-in, and every calculation runs inside your browser. Nothing you type is sent to a server or stored, and the page keeps working offline once it has loaded.

Private by design. No accounts, no cookies, no tracking. Everything you type stays on your device.

How we keep it that way