— Developer Tools

Free YAML Formatter

Check a YAML file, tidy its indentation, or turn it into JSON, with errors pinned to the exact line and column.

— Samples
In 171Out 186Valid
Live

What is a YAML Formatter?

A YAML formatter checks that a YAML document is valid and rewrites it with consistent indentation. YAML is the indentation-based format behind Docker Compose files, Kubernetes manifests and CI pipelines, where one misplaced space can break a deploy.

This tool parses your document with the YAML 1.2 rules used by modern tooling, then prints it back in clean block style or converts it to JSON. Merge keys are resolved the way Docker Compose and GitLab CI resolve them. When the document is invalid, the error names the problem and gives the line and column where the parser stopped.

Key Features

Problems Pinned to a Line and Column

An invalid document shows exactly where parsing failed and what kind of mistake it was, from a tab used for indentation to a duplicate key.

One-Click YAML to JSON

Switch to To JSON to see the data as a program will read it. That is the fastest way to catch values YAML parsed differently than you expected.

Consistent Two-Space Indentation

Pretty rewrites mixed indentation and inline lists into tidy block style with two spaces per level, so diffs and reviews stay readable.

Modern YAML 1.2 Rules

Words like no, on and yes stay as strings instead of turning into booleans, as they did under YAML 1.1. Your country codes and workflow triggers survive.

Configs Stay Private

Parsing happens in the browser, so environment files with hostnames or credentials aren’t uploaded anywhere.

Turns JSON Into Readable YAML

Paste a JSON payload and Pretty rewrites it as block-style YAML. It is a quick way to start a config file from an API response.

Perfect for everyone

  • DevOps engineers editing Kubernetes manifests
  • Developers fixing docker-compose files
  • CI maintainers writing GitHub Actions workflows
  • Data engineers reading Airflow and dbt configs

How to Use the YAML Formatter

Paste a document, choose an output, and read the result or the error.

1

Paste Your YAML

Paste a whole file or a fragment. One document at a time works best; split multi-document files at their --- separators first.

2

Choose Pretty or To JSON

Pretty re-indents the YAML in block style. To JSON shows the same data as JSON, which reveals exactly how each value was typed.

3

Fix Any Reported Error

If the footer turns red, read the line and column in the error, fix that spot in the source, and the result reappears as soon as the document parses.

4

Copy the Clean Version

Copy the formatted YAML back into your repository or download it as a file. Comments aren’t kept in the output, so keep your original if it has notes you need.

Worked Examples

Documents Run Through This Tool

Each row is a document we pasted here and the exact output, or the exact error, it produced. The JSON rows show how YAML actually typed each value.

REF_001Pretty

“name: Ada role: editor items: [ink, paper] ”

REF_002To JSON, typed values

“country: no version: 1.10 port: 08080 ”

REF_003To JSON, workflow

“on: push jobs: test: runs-on: ubuntu-latest”

REF_004To JSON, merge key

“base: &base replicas: 2 prod: <<: *base replicas: 5”

REF_005Unclosed list

“name: [Ada”

REF_006Bad nesting

“key: value bad: indent”

REF_007Duplicate key

“a: 1 a: 2”

REF_008Open quote

“x: "unterminated”

REF_009Tab indent

“ key: value”

REF_010Two documents

“--- a: 1 --- b: 2 ”

Syntax Reference

YAML Rules That Decide How Data Is Read

Most YAML bugs come from a handful of rules about indentation, quoting and typing. Each entry shows what the parser does with a real snippet.

01 / INDENTATION

Indentation Defines Nesting

A key indented further than the line above belongs to it. Any consistent number of spaces works, but every sibling must use the same amount.

“Is indentation optional in YAML?”

02 / TABS

Tabs Are Never Indentation

The YAML spec forbids tab characters for indentation. Editors that insert tabs produce files that every parser rejects.

“Can a tab indent a key?”

03 / DASHES

Dashes Start List Items

A line starting with a dash and a space is a sequence entry. The flow form with square brackets means the same list.

“What does [ink, paper] become in block style?”

04 / UNQUOTED

Unquoted Words Are Strings in YAML 1.2

Under YAML 1.2, yes, no, on and off are plain strings. YAML 1.1 parsers still read them as booleans, which is how country code NO once became false.

“What is country: no in YAML 1.2?”

05 / NUMBERS

Numbers Lose Trailing Zeros

version: 1.10 is read as the number 1.1, because 1.10 and 1.1 are the same float. Quote version strings to keep them exact.

“What is version: 1.10 in JSON?”

06 / COLONS

Colons in Values Can Need Quotes

A colon followed by a space inside a value starts a new key. Quote values such as times or URLs when they contain that pattern.

“Is image: nginx:1.27 safe unquoted?”

07 / ANCHORS

Anchors and Aliases Reuse Values

&name marks a value and *name repeats it elsewhere. Large configs use this to avoid copying the same block several times.

“Which character defines an anchor?”

08 / MERGE

Merge Keys Combine Mappings

A line with << and an alias copies the anchored keys into the current mapping, and keys written after it override them. Compose and GitLab CI rely on this.

“Which wins, the merged or the local key?”

09 / KEYS

Keys Must Be Unique

The spec requires every key in a mapping to be unique. Some lenient parsers silently keep the last value, which hides bugs this tool reports.

“Is a: 1 then a: 2 valid?”

10 / THREE

Three Dashes Separate Documents

A line of --- starts a new document, so one file can hold several, as Kubernetes manifests often do. Format them one at a time here.

“What does --- mean on its own line?”

YAML Versions and Dialects

Not every tool reads YAML the same way, and the differences show up in real configs.

YAML 1.2, Used Here

The 2009 core schema removed most implicit booleans and octal quirks. It is what this tool, the yaml npm package and Go’s yaml.v3 follow.

YAML 1.1 in Older Parsers

PyYAML and some Ruby tools still read yes, no, on and off as booleans. A file that formats fine here can still behave differently there.

Kubernetes Manifests

Kubernetes reads YAML and converts it to JSON internally, so the To JSON view shows what the API server actually receives.

Docker Compose Files

Compose files lean on anchors and merge keys for shared settings. The JSON view shows each service after merging.

GitHub Actions Workflows

The on key of a workflow must stay the string on, and YAML 1.2 keeps it that way. Old YAML 1.1 parsers turned it into true.

JSON Is Valid YAML

YAML 1.2 is a superset of JSON, so any JSON file parses here too. Pretty then rewrites it in block style.

Ansible Playbooks

Ansible parses YAML with PyYAML, which follows YAML 1.1, so an unquoted yes in a playbook becomes true there. Quote such values when a file moves between tools.

YAML Mistakes That Break Configs

These cause most failed deploys that trace back to a YAML file.

Tip 01

Mixing Indent Widths

Two spaces in one block and four in its sibling make the parser misplace keys. Pick one width for the whole file and stick to it.

Tip 02

Unquoted Version Numbers

1.10 becomes 1.1 and 3.0 becomes 3. Quote version strings, image tags and anything that must stay exactly as typed.

Tip 03

Leading Zeros in Numbers

port: 08080 is read as the number 8080, and zip codes lose their leading zero. Quote any value where leading zeros matter.

Tip 04

Copying From Web Pages

Code copied from a web page can carry non-breaking spaces or tabs that look like normal spaces. Retype the indentation if a valid-looking file fails.

Tip 05

Booleans Across Parsers

Write true and false, never yes and no, if any tool in your pipeline might use YAML 1.1. It avoids values flipping type between tools.

Tip 06

Losing Comments

Formatting rebuilds the document from data, so comments are dropped from the output. Keep your original file when its comments matter.

Tip 07

Check Types With To JSON

When a config misbehaves but looks right, convert it to JSON. Quotes appear around strings and not around numbers or booleans, so wrongly typed values stand out at once.

Tip 08

Picking the Wrong Block Scalar

A literal block starting with a pipe keeps every line break, while a folded block starting with a greater-than sign joins lines with spaces. Scripts embedded in CI files almost always need the pipe.

Where a YAML Formatter Helps

YAML runs a lot of infrastructure, so a quick check saves broken pipelines.

Fixing a Failing CI Pipeline

When GitHub Actions or GitLab CI rejects a workflow, paste it here to get the line and column of the problem before pushing another commit.

Reviewing Kubernetes Manifests

Check a manifest for duplicate keys and bad indentation before kubectl apply. Duplicates are easy to miss in long files.

Debugging Docker Compose

Convert a compose file to JSON to see each service after anchors and merge keys are applied, exactly as Compose sees it.

Converting Config for an API

Many APIs accept JSON only. Convert a YAML config to JSON and paste it into the request body.

Cleaning Up Generated Files

Tools that export YAML often mix inline and block style. Pretty rewrites the file in one consistent style before you commit it.

Checking OpenAPI Specs

OpenAPI definitions are often written in YAML. Validate one quickly before loading it into a docs generator or client generator.

Teaching YAML Typing

Show students how no, 1.10 and 08080 change type by converting them to JSON. The result makes YAML’s implicit typing obvious.

Frequently Asked Questions