Home/Developer Tools/YAML Beautifier & Validator
📄

YAML Beautifier & Validator

FREE

Format YAML and find the line that breaks it

Free · No sign-up required
Loading...

What the YAML tools do

YAML is the configuration language of Kubernetes, Docker Compose, GitHub Actions, Ansible, Helm and most CI systems — and it is unforgiving about indentation. This tool validates a YAML document, reporting the line and reason for any parse error, and beautifies it with consistent two-space indentation and spacing. Parsing runs in your browser, so config files containing hostnames, keys or internal paths are never uploaded.

YAML in one screen

# Comments start with a hash service: name: api # key: value (a space after the colon is required) replicas: 3 # numbers are unquoted enabled: true # booleans: true / false version: "1.10" # quote strings that look like numbers ports: # a list — each item starts with "- " - 8080 - 8443 env: - name: LOG_LEVEL value: info # a list of maps description: > # folded block: newlines become spaces A long sentence on several lines. script: | # literal block: newlines are kept echo start ./run.sh

The errors the validator catches most

SymptomCauseFix
mapping values are not allowed hereA colon in a value without quotes, or a key on the wrong indentationQuote the value or fix the indent
bad indentation of a mapping entryMixed 2- and 4-space indents, or a tab characterUse spaces only, consistently
could not find expected ':'A key missing its colon, or a list item where a key was expectedCheck the line before the reported one
duplicated mapping keyThe same key twice in one mapRemove or rename one
unexpected end of the streamAn unclosed quote or blockCheck quotes on the last few lines

Errors are reported at the line where parsing failed, which is often one line after the real mistake — a missing colon on line 12 usually surfaces as an error on line 13.

Traps that parse fine but mean the wrong thing

  • The Norway problem: in YAML 1.1, country: NO is the boolean false. So are yes, on, off and y. Quote them.
  • Octal surprise: mode: 0755 may be read as the decimal 493. Quote it, or write 0o755.
  • Version numbers: version: 1.10 becomes the float 1.1. Quote it.
  • Times: time: 12:30 can be parsed as 750 (sexagesimal). Quote it.
  • Trailing spaces and tabs are invisible but change meaning; the beautifier removes them.
  • Anchors and aliases (&default / *default) are powerful but easy to over-use; the validator resolves them so you can see the expanded result.

What the beautifier changes

  • Normalises indentation to two spaces per level.
  • Puts exactly one space after each colon and dash.
  • Removes trailing whitespace and collapses runs of blank lines.
  • Keeps comments, key order, quoting style and block scalars as written.

The output means the same thing as the input. It does not reorder keys or change values, so it is safe to run on production configs.

YAML vs JSON

Every JSON document is valid YAML, but not the reverse. YAML adds comments, multi-line strings, anchors and a whitespace-based structure that is easier to read and write by hand — and easier to get subtly wrong. JSON is stricter, has no comments, and is better for machine-to-machine data. Use the JSON Tools page for JSON; if you need to move between them, the JSON Converter handles YAML output.

Frequently asked questions

Does the validator check Kubernetes or GitHub Actions schemas?

No. It checks that the document is well-formed YAML. Whether the keys are valid for a particular tool needs that tool's own linter (kubeval, actionlint, ansible-lint).

Why is my multi-document file failing?

Documents separated by --- are supported. A common failure is content before the first --- that is not valid on its own, or a stray --- inside a block scalar.

Can I convert YAML to JSON?

Use the JSON Converter tool, which accepts YAML input and produces JSON, and vice versa.

Are tabs really forbidden?

For indentation, yes — YAML requires spaces. Tabs inside a quoted string value are fine.

Which YAML version is used?

The parser follows YAML 1.2 core schema, so 'NO' and 'yes' are strings, not booleans. Tools that still use 1.1 (some older Python and Ruby libraries) will treat them differently — quoting is the safe habit.

Is the file uploaded?

No. Validation and formatting run in your browser.

More tools in this category

📋
JSON Tools
View tree, format, validate and minify JSON
📋
XML Tools
Beautify, validate and convert XML to JSON
🗃
SQL Formatter & Minifier
Lay out SQL clause by clause, or collapse it to one line
📝
Markdown Tools
Preview Markdown, convert to HTML and generate tables
🔑
JWT Encoder & Decoder
Decode a JWT's header and payload, or sign one with HS256
🔐
URL & Base64 Encoder / Decoder
Percent-encode for URLs or convert to and from Base64