YAML Formatter

Format YAML with consistent indentation while preserving comments and anchors.

Data & Formats
Preparing your workspace…
Input
Output
Your result will appear here.

How to use

  1. Paste text, open a UTF-8 file, or try the Sample.
  2. Choose the input and settings, then run the tool or enable Auto run.
  3. Review the result, then copy or download it. Changing the input invalidates the previous result.

YAML Formatter

Format YAML with consistent indentation while preserving comments and anchors.

Processing runs in your browser. Your input is not sent to DevToolsy.

How it works

Format YAML 1.2 configuration files, including multi-document streams. The parser rejects invalid syntax and duplicate keys before formatting. Anchors, aliases and custom tags remain in the text.

Before and after
Input
# Application settings
app: {name: DevToolsy, enabled: true}
defaults: &defaults
  retries: 3
  timeout: 5000
worker:
  <<: *defaults
  queue: tasks
---
environment: production
Output
# Application settings
app: { name: DevToolsy, enabled: true }
defaults: &defaults
  retries: 3
  timeout: 5000
worker:
  <<: *defaults
  queue: tasks
---
environment: production

Format YAML with consistent indentation while preserving comments and anchors.

Options and data fidelity

Choose indentation and line width. Formatting preserves numeric tokens and does not expand aliases. It does not validate Kubernetes, CI or application-specific configuration rules.

Working with the result

This page produces readable YAML. Use the separate YAML to JSON tool for conversion; it has different restrictions for tags, aliases and numeric values.

Review the result, then copy or download it. Changing the input invalidates the previous result.

Processing limits

UTF-8 input up to 1 MiB per document, output up to 8 MiB. JSONPath and Schema: 5-second timeout; other tools: 30 seconds.

Further readingYAML 1.2.2
?

Frequently asked questions

Can I format multiple YAML documents?

Format YAML 1.2 configuration files, including multi-document streams. The parser rejects invalid syntax and duplicate keys before formatting. Anchors, aliases and custom tags remain in the text.

What does YAML formatting preserve?

Choose indentation and line width. Formatting preserves numeric tokens and does not expand aliases. It does not validate Kubernetes, CI or application-specific configuration rules.

Is this a YAML to JSON converter?

No. This page produces readable YAML. Use the separate YAML to JSON tool for conversion; it has different restrictions for tags, aliases and numeric values.

Is my input uploaded?

Processing runs in your browser. Your input is not sent to DevToolsy.

Can I open a local file?

UTF-8 input up to 1 MiB · output up to 8 MiB

Find your next tool

Language

Switch language? Your current work will be cleared. Copy or download it first.