Help
  • YAML uses spaces, not tabs, for indentation
  • Check "Keep comments" to preserve original comments during formatting

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 spaces), 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 the validate button to check for syntax errors, tab indentation, and duplicate keys. It also flags boolean spelling errors (e.g., "tru"/"flase"), trailing whitespace, excessively long lines, comment formatting issues, and trailing blank lines.
  • Local files: Drag and drop or select local YAML/YML files
  • 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