Text Beautifier

Text Beautifier


About the YAML Beautifier

YAML is the configuration language of modern infrastructure: Kubernetes manifests, Docker Compose files, GitHub Actions and GitLab CI pipelines, Ansible playbooks, Helm charts and OpenAPI specifications are all written in it. YAML is readable, but it is also strict about indentation — one misplaced space can change the meaning of a file or make it invalid.

The YAML beautifier parses your document and re-emits it with consistent indentation, which both validates the syntax and normalises the layout. If the file cannot be parsed, you get an error with the line and column where parsing failed.

Common uses

  • Validating a CI pipeline or Kubernetes manifest before committing it.
  • Normalising indentation in a file edited by several people with different editor settings.
  • Finding the line that breaks a Docker Compose or Helm values file.
  • Converting messy hand-written YAML into a clean, consistent style.

How to use it

  1. Paste your YAML into the input box (or click Try Me).
  2. Press Beautify.
  3. Copy or save the normalised YAML, or fix the reported line if parsing failed.

Example

Inconsistent indentation in a Compose file is normalised:

Input
services:
    web:
      image: nginx:1.27
      ports: [ "8080:80" ]
Output
services:
  web:
    image: nginx:1.27
    ports:
    - 8080:80

Tips and common pitfalls

  • YAML forbids tab characters for indentation. Configure your editor to insert spaces in .yml files.
  • Watch for the "Norway problem": in YAML 1.1 parsers, unquoted values like no, yes, on and off may become booleans. Quote them when you mean text, for example country: "NO".
  • Values that look like numbers, such as 1.10 or 0755, may be parsed as numbers. Quote version strings and file modes.
  • A colon followed by a space starts a key/value pair, so quote strings that contain : , such as URLs with ports in some contexts or sentences.

Frequently asked questions

Is YAML a superset of JSON?

YAML 1.2 is designed so that almost every valid JSON document is also valid YAML. That is why you can often paste JSON into a YAML file and it still works.

Does the beautifier keep my comments?

Comments are not part of the YAML data model, so a round-trip through a parser can drop them. Keep a copy of the original if your comments matter.

Why do my anchors and aliases look different?

Anchors (&name) and aliases (*name) may be expanded or re-emitted in a normalised form, depending on how the document is serialised.

How many spaces should YAML use?

Any consistent number works, but two spaces is the convention for Kubernetes, Compose and most CI systems.

Related