← Back to tool

Format · Indent · Beautify

Format and indent a YAML file

Updated: May 2026

Messy YAML — copied from multiple sources, auto-generated, or edited inconsistently — is hard to read and a source of errors. The most reliable way to reformat it: run it through a YAML → JSON → YAML cycle. You get clean, uniformly indented YAML with no artifacts.

Format my YAML →

Free · No upload · Browser-based

Before / after formatting

Messy YAML (irregular indentation, inline objects mixed in):

name: alice
  age: 30
roles:
 - admin
 - editor
address: {city: London,zip: "EC1A"}

Formatted YAML (uniform 2-space indentation, clear structure):

name: alice
age: 30
roles:
  - admin
  - editor
address:
  city: London
  zip: EC1A

The conversion normalizes indentation (2 spaces per level), expands inline objects, and produces a clean hierarchical structure.

Limitations of format-by-conversion

  • Comments removed: YAML comments don't survive the JSON round-trip. Re-add them manually.
  • Key order: by default, insertion order is preserved. Enable "Sort keys" for alphabetical output.
  • Block scalars: | and > blocks are converted to JSON strings then re-rendered as regular strings or blocks based on content.

How to format with Flowfiles

  1. Paste your YAML in the source area in YAML → JSON mode.
  2. Convert to verify it parses correctly.
  3. Copy the resulting JSON.
  4. Switch to JSON → YAML mode.
  5. Paste the JSON and convert. The output YAML is cleanly formatted.

Frequently asked questions

Does formatting change any values?

No. The JSON ↔ YAML cycle is semantically neutral: values, types, and structure are preserved.

Can I choose 4-space indentation?

The YAML output currently uses 2-space indentation per level, which is the most widely adopted convention.

Are strings with special characters preserved?

Yes. Strings that require quoting (colons, reserved YAML characters) are automatically quoted in the output YAML.