Help
  • YAML uses spaces, not tabs, for indentation; indent width can be set to 2 or 4 spaces
  • Check "Keep comments" to preserve original comments during formatting
  • Preserves high-precision numbers

YAML Formatter

This free online YAML formatter formats, minifies, and validates YAML, making it easier to read and debug — in one click.

All tools on this site run entirely in your browser locally. No data is uploaded to any server.

Features:

  • Format YAML: Auto-format indentation (2 or 4 spaces, 2 by default), fix nesting structure, support folding/expanding nodes
  • Keep comments: When enabled, original comments are preserved (including trailing comments); the setting is remembered; in compact mode, comments are dropped
  • Compact mode: Converts objects/arrays to flow-style (inline) format, smaller size for comparison
  • Syntax validation: Real-time syntax error hints after input, helps locate indentation or colon issues
  • YAML validation: Click Validate to check for syntax, indentation, duplicate keys, boolean typos, trailing whitespace, long lines, comments, and trailing blank lines.
  • Local files: Drag and drop or select local YAML/YML files
  • Number preservation: Formatting and minifying keep numbers exactly as written, so 1.0 never becomes 1, and long integers like 123456789012345678901234567890 are neither converted to scientific notation nor rounded
  • Real-time processing: Auto-formats on input, or manually click the format button to reformat
  • Export results: One-click copy, save as file, with search, jump to line and fullscreen view

Common uses:

  • Formatting and beautifying YAML config files (e.g., Docker Compose, Kubernetes, Spring Boot)
  • Troubleshooting YAML indentation or syntax issues and quickly locating the errors
  • Comparing config differences across versions; compact mode is ideal for diff
  • Organizing Ansible Playbooks, GitHub Actions and other YAML script files
  • Converting JSON results to YAML for use in configuration management tools