Home / YAML tools / YAML beautifier

YAML Beautifier

Turn compact, flow-style or messy YAML into clean block style, with every key on its own line. You can also paste JSON.

Options

Result

Make YAML readable

YAML can be written in two styles. The block style puts each key and list item on its own line and uses indentation to show the structure. The flow style uses braces and brackets like JSON, and can pack a lot into one line. The beautifier expands the flow style into the block style, so that the file is easy to read and to compare.

# Flow style
config: {name: demo, ports: [80, 443], env: {MODE: prod, DEBUG: false}}

# Block style
config:
  name: demo
  ports:
    - 80
    - 443
  env:
    MODE: prod
    DEBUG: false

JSON is YAML too

Almost every JSON document is also valid YAML. If you paste JSON, the beautifier turns it into block style YAML, which is a quick way to convert it. For a conversion with more options, use JSON to YAML.

How this page is set up

This page starts with Expand flow style turned on and long text wrapped at 80 characters. The same engine runs the YAML formatter, which starts with gentler settings, and you can change every option on both pages.

  • Comments and blank lines are kept, unless you tick Remove comments.
  • Values are not changed. Only the layout is.
  • Sort keys puts every mapping in alphabetical order, which helps when you compare two files.
  • If the YAML has an error, you see the error with its line and column, and nothing is changed.

Everything is done in your browser. If you need to make the YAML smaller instead, convert it to JSON with the YAML to JSON converter and use the minified option. The YAML syntax guide explains the two styles in more detail.

Frequently asked questions

How do I beautify YAML?

Paste it into the box and press Beautify. Flow style is expanded into block style and the indentation is made consistent.

Can I paste JSON into the YAML beautifier?

Yes. JSON is almost always valid YAML, so it is turned into block style YAML.

Are comments kept?

Yes, unless you tick Remove comments.

What is the difference between the beautifier and the formatter?

They use the same engine. The beautifier starts with Expand flow style turned on and long lines wrapped at 80 characters.