YAML Formatter

Tidy a YAML document with consistent indentation and line breaks.

Category: Dev Tools

When to use?

Use it to tidy YAML for CI/CD config, Docker Compose, and app config files to a consistent format.

How to use

  • Paste the YAML code.
  • Press format to fix indentation and line breaks.
  • Copy the tidied YAML.

Input Explanation

Enter a YAML document with inconsistent spacing or format.

Calculation Basis

It reads the YAML string into a JS object with a parser like js-yaml, then re-dumps it into standardized YAML with standard (usually 2-space) indentation.

Usage Examples

  • Tidy config files - Tidy CI, Docker, and app config YAML for readability.
  • Quick pre-deploy check - Check inputs and output to reduce errors before dev/ops work.
  • Aid docs/reviews - Copy the tidied result into dev docs, issues, or review comments.

Examples

  • YAML config with inconsistent spacing → unified to standard 2-space indentation
  • Kubernetes config YAML with varied spacing → unified to 2-space indentation

Cautions

  • The entered YAML is processed only in the browser and not sent to a server.
  • YAML is sensitive to indentation; parse errors prevent tidying.

Guides

YAML indentation rules

YAML expresses structure with indentation. Use spaces instead of tabs, and a parse error occurs if indentation depth is inconsistent.

Validate config files

For YAML environments like docker-compose.yml, GitHub Actions workflows, and Kubernetes configs, it quickly finds indentation or key errors.

FAQ

Is the YAML data stored?

No. Formatting happens only in the browser.

Is the pasted YAML sent out?

No. YAML tidying runs only in the browser and config is not sent out.

How is indentation unified?

It uses standard 2-space indentation; since YAML is indentation-sensitive, it aligns to a consistent width.

Does it catch indentation errors?

If indentation cannot be parsed, it does not tidy. YAML is sensitive even to a one-space difference.

Related Tools

  • JSON Formatter - Beautify or minify JSON strings instantly and check for validity errors.
  • UUID Generator - Generate up to 20 cryptographically secure UUID v4 values at once.
  • Password Generator - Generate secure random passwords in the browser by choosing length, character set, and count.
  • JWT Decoder - Decode a JWT header and payload to view the JSON and key claims.
  • Regex Tester - Enter a regex pattern to see matches in text in real time.
  • QR Code Generator - Convert text or a URL into a QR code and download it as an image.