YAML formatter and validator

Paste YAML to fix its indentation. Comments and everything else stay as written. The gray text is an example.

Formatted
# Deploy settings
service:
  name: api        # shown in logs
  replicas: 3
  ports:
    - 8080
    - 8443
  env:
    LOG_LEVEL: info
    motd: |
      Welcome.
      Have a nice day.

Example. Paste or type YAML, or open or drop a file.

Good to know

What changes
Indentation, spaces at the ends of lines, and Windows line endings (they become plain line breaks). A block's indentation number, as in |2, is updated to match. Comments, key order, quotes and block text (| and >) stay as written.
Checked
The formatted YAML is read back and compared with yours, and shown only if it holds the same data. Files with several documents (---) are checked one document at a time. Files this page cannot read back yet (anchors, tags, values spread over several lines) are not formatted; the message says which line.
Lists
A list item keeps its - , and the keys under it line up after it. Lists written at the same indent as their key stay that way.
Tabs
YAML does not allow tabs for indentation. The first one is named with its line.
yes and no
Read as text, as in YAML 1.2 (also on and off). Older YAML 1.1 tools such as PyYAML read them as true and false. One-line output puts them in quotes, so every reader agrees.
One line
Writes the data on a single line in YAML's flow style, like JSON with fewer quotes. Comments are not kept there. To convert to JSON itself, use YAML to JSON.
Open from a link
?input=a:%0A%20%20%20%20b:%201 opens the page with that YAML; add &indent=4 or min.