YAML Formatter

Format and validate YAML files — supports multi-document, anchors, and Kubernetes manifests.

YAML Formatting Best Practices

  • Always use 2-space indentation for Kubernetes and Docker Compose files.
  • Never use tab characters — YAML parsers reject them by specification.
  • Use string quotes around values that look like numbers or booleans to prevent type coercion (e.g., version: "1.0").
  • Validate YAML in CI/CD pipelines before deployment using yamllint or the built-in --dry-run flags.

Frequently Asked Questions

Does this YAML formatter support Kubernetes YAML?

Yes. The formatter handles all standard YAML including Kubernetes manifests, Docker Compose, GitHub Actions, and GitLab CI configurations.

Will the formatter preserve YAML comments?

The formatter reformats YAML structure. Due to how YAML parsing works, some comments may be normalized or repositioned. For comment-sensitive files, manually verify the output.

Why does YAML forbid tabs?

The YAML 1.1 and 1.2 specifications explicitly prohibit tab characters for indentation. Use spaces instead. Most editors can be configured to auto-convert tabs to spaces.