YAML Format & Lint

Paste or import YAML, format with 2/4-space indent, optionally sort keys, and validate syntax — locally in your browser.

All processing on this page runs locally in your browser unless noted otherwise.

How to use

  1. Paste YAML or import a .yml file.
  2. Choose indent / sort keys / keep comments, then Format or Validate.
  3. Copy, download, or share a link. Open in Diff to compare versions.

Example

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
          resources:
            requests:
              cpu: 50m
              memory: 64Mi
            limits:
              cpu: 200m
              memory: 128Mi

FAQ

Are comments preserved?

When “Keep comments” is on, Yaml Workbox uses the YAML Document API to round-trip comments best-effort. Turning it off re-serializes from data and drops comments.

Does multi-document YAML work?

Yes. Documents separated by --- are formatted individually and joined again.

Is anything uploaded?

No. Formatting and validation run entirely in your browser.

Related tools