Format Kubernetes YAML — Multi-Doc Manifests

Pretty-print Kubernetes manifests in your browser, including multi-document YAML separated by ---. Choose indent 2 or 4. Comments are dropped by the js-yaml round-trip. Not a generic YAML beautifier — for that use beautify YAML.

Loading…
Kubernetes YAML formatter — multi-doc manifests
Normalize indentation on Kubernetes manifests before review or paste into tickets. Supports multi-document streams; not a generic YAML beautifier.

Developer notes

• Uses js-yaml loadAll + dump — YAML comments and some stylistic details are lost. • Each document root must be a mapping (object), not an array or scalar. • Empty / null documents in a stream are skipped. • Max input 512 KB. • For non-Kubernetes YAML use beautify YAML.

Options

Indent width
Spaces per indentation level in the dumped YAML (2 or 4).

When teams pick this route

• Clean up hand-edited Deployment/Service snippets before a PR. • Normalize multi-doc kubectl get -o yaml dumps for reading. • Align indent 2 vs 4 across pasted examples. • Pair with validate Kubernetes for structural checks.

Worked examples

Compact Deployment → indented

Before

apiVersion: apps/v1 kind: Deployment metadata: name: web labels: {app: web} spec: replicas: 2 selector: matchLabels: {app: web} template: metadata: labels: {app: web} spec: containers: - name: web image: nginx:1.27 ports: - containerPort: 80

After format

apiVersion: apps/v1 kind: Deployment metadata: name: web labels: app: web spec: replicas: 2 selector: matchLabels: app: web template: metadata: labels: app: web spec: containers: - name: web image: nginx:1.27 ports: - containerPort: 80

Multi-document stream preserved

Before

apiVersion: v1 kind: ConfigMap metadata: name: app-config data: LOG_LEVEL: info --- apiVersion: v1 kind: Service metadata: name: web spec: selector: app: web ports: - port: 80

After format

apiVersion: v1 kind: ConfigMap metadata: name: app-config data: LOG_LEVEL: info --- apiVersion: v1 kind: Service metadata: name: web spec: selector: app: web ports: - port: 80

Navigate related Kubernetes tools

Validate structure with validate Kubernetes, format Helm values via format Helm values, or open the Kubernetes hub. For generic YAML see beautify YAML.

Kubernetes formatter FAQ

Multi-doc YAML layout

When should I use beautify YAML instead?

Use beautify YAML for generic YAML (Compose, CI configs, data files). Use format Kubernetes when you specifically want multi-doc Kubernetes manifests pretty-printed in this cluster.

Are comments preserved?

No. js-yaml parse + dump drops comments. Keep a copy if you rely on inline documentation.

Does it run kubectl or apply to a cluster?

No. Formatting is entirely in-browser. Nothing is sent to a cluster or API server.

What is the size limit?

512 KB per paste. Split large multi-doc dumps before formatting.

Looking for converters, encoders, formatters, and minifiers in one place? Developer tools hub Open the curated developer tools catalogue.