TodayTools

YAML formatter and validator

Paste YAML to check it and tidy it. Ctrl+C copies the result.

PrivateNo uploadsRuns in your browser

Donate
Style

Tidy keeps comments and writes clean blocks. Sort keys puts names in A to Z order.

Need JSON instead? Convert YAML to JSON

Man Working

For tidy configs

Every space in the right place.

Late tweak. Puneeth tidies the settings file before bed.

BeforeHunting a stray space

With sdevClean, even indents

  • Happy Couple

    Neat and even

    Every line sits where it belongs.

  • Friends Family

    Evening free

    No more chasing a stray space.

How to format and check YAML

  1. Paste or open

    Paste YAML into the Input pane, press Open to pick a .yaml or .yml file, or drop it on the pane. Sample loads a small trip plan.

  2. Pick the style

    Tidy writes clean block YAML with the indent you choose. Compact writes it on one line. Tick Sort keys to put keys in A to Z order. Mistakes show their line and column.

  3. Copy or download

    Press Copy, or Ctrl+C with nothing selected, to copy the result. Download saves it as a .yaml file.

Good to know

  • YAML does not allow tabs for indenting. If the error mentions a tab, replace it with spaces.
  • Files over 2 MB stay out of the editor; a worker reads them from disk so the page does not freeze. Only the first 1 MB of the result is drawn, Copy and Download use all of it.
  • Duplicate keys in one map are reported as an error, because most programs would silently keep only one of them.
  • Long text is kept on one line instead of being folded, so the file stays easy to compare.

Where people use it

  • Fix a failing deploy

    A single wrong space breaks YAML. Paste it and see the exact line that needs a fix.

  • Clean up a config

    Make indents even and sort keys so the file is easy to review.

  • Check before you commit

    Validate a workflow or compose file before you push it.

  • Need it as JSON?

    Turn the checked YAML into JSON next.

    YAML to JSON and JSON to YAML converter

Why this one

It tells you in plain words where the YAML is wrong, which saves a lot of guessing with spaces.

  • Clear error messages with the line number.
  • Even, tidy indents in one click.
  • Your files stay in your browser.

What you can change

  • Indent 2 spaces, 4 spaces or tab
  • Sort keys
  • Keep comments

People find this page by searching

  • yaml formatter
  • yaml validator
  • yaml lint online
  • format yaml online
  • yaml beautifier
  • check yaml syntax
  • yaml indentation checker
  • docker compose yaml validator
Cite this tool
  • APA
    sdev.in. (n.d.). YAML formatter online [Web tool]. https://www.sdev.in/tools/yaml-formatter
  • MLA
    "YAML formatter online." sdev.in, https://www.sdev.in/tools/yaml-formatter.
  • Chicago
    sdev.in. "YAML formatter online." https://www.sdev.in/tools/yaml-formatter.
  • BibTeX
    @misc{sdev-yaml-formatter,
      title = {YAML formatter online},
      author = {{sdev.in}},
      howpublished = {\url{https://www.sdev.in/tools/yaml-formatter}},
      note = {Web tool}
    }

Questions people ask

Are my comments kept?

Yes, in the normal tidy mode. Comments stay next to the line they belong to, also when keys are sorted. Compact mode writes everything on one line, so it leaves comments out.

What does the error message mean?

It names the first line and column where the YAML stops making sense. Press Go to error to jump there. The usual causes are a tab used for indenting, a missing space after a colon, or a list item that is not lined up with the others.

Can I check a file with several documents?

Yes. Documents separated by --- are each checked and tidied, and stay in the same order. The status line shows how many there are.

Does it change my values?

No. Values, quotes that matter, anchors (&name) and aliases (*name) are written back as they are. Only spacing, indent and, if you ask, key order change.

Is my file uploaded?

No. Checking and formatting run in a background worker inside your browser. Nothing is sent to a server.

Donate