Free online tool · runs in your browser · no sign-up

Format YAML, instantly.

Paste messy YAML or JSON, and get clean, valid output in real time. Convert between YAML, JSON, TOML, and XML, explore the tree view, or validate against a JSON Schema.

100% client-side No sign-up Free & unlimited Nothing uploaded
Formatted YAML will appear here
Valid
|21 lines353 chars|Ctrl+Enter to format|YAML 1.2
Try an example:

Everything you need

A complete YAML toolset

Format, validate, convert, visualize, and verify — all in one browser-based toolkit.

Instant Formatting

Beautify messy YAML with perfect, consistent indentation in milliseconds. The formatter normalizes spacing and aligns nesting, turning unreadable configs into clean, scannable files — whether you have two lines or two thousand.

Syntax Validation

Every input is checked against the YAML 1.2 specification. Errors are highlighted with the exact line and column, plus a plain-language hint explaining what went wrong and how to fix it — no more guessing which line broke your deploy.

File Upload & Drag

Drop .yaml or .yml files straight into the editor, or paste from anywhere. Everything runs locally in your browser, so sensitive keys and credentials never leave your machine.

YAML to JSON, TOML & XML

Convert YAML to JSON, TOML, or XML in one click. The conversion is lossless and follows YAML 1.2, so nested objects, arrays, anchors, and aliases all resolve correctly — perfect for feeding configs into APIs, CI tools, and JSON-, TOML-, or XML-only pipelines.

Real-time Feedback

See the formatted output update as you type — no submit button, no waiting. The instant feedback loop lets you experiment with indentation and structure until everything reads exactly right.

Multi-document

YAML files often hold several documents separated by ---, like a Deployment plus a Service. The formatter processes each document independently and preserves the separators, so nothing gets merged or lost.

JSON Schema Validation

Validate your YAML against a JSON Schema to catch structural errors — wrong field names, missing required keys, invalid types — before they break a deployment. A capability most other YAML tools do not offer.

Tree View

Visualize any YAML document as a collapsible tree with values color-coded by type. It's the fastest way to understand deeply nested configs and confirm every key ended up where you intended.

Expand Anchors

Resolve YAML anchors (&), aliases (*), and merge keys (<<) into fully expanded values with one checkbox. Instantly see the final structure your tooling actually receives — no more tracing references by hand.

How it works

Format YAML in three steps

No install, no sign-up. Your YAML is formatted the moment it hits the editor.

1

Paste or drop a file

Paste YAML from any source — a config file, a CI/CD pipeline, a Kubernetes manifest, or an Ansible playbook. You can also drag and drop a .yaml or .yml file straight into the editor, load it from a URL, or start from one of the built-in examples.

2

It formats automatically

A YAML 1.2 parser normalizes indentation, fixes spacing, and flags syntax errors with the exact line and column — all locally in your browser, in milliseconds. The status bar shows validity, line count, and processing time as you work.

3

Copy, convert, compare

Copy the clean output, switch to the YAML to JSON, YAML to TOML, or YAML to XML tab to convert it, use the diff view to see exactly what changed, or download the result as a .yaml, .json, .toml, or .xml file. Ctrl+Enter formats on demand.

Use cases

YAML everywhere you work

YAML is the backbone of modern infrastructure-as-code. Here's how our formatter helps with the files you touch every day.

Kubernetes manifests

Deployments, Services, ConfigMaps, and Ingresses are all YAML. A single misplaced space or tab stops a pod from scheduling, and kubectl only reports "error converting YAML to JSON" without a line number. Our formatter pinpoints the exact line and column, and the tree view lets you verify that every field is nested at the right level before you run kubectl apply.

Docker Compose

Multi-container apps depend on docker-compose.yml. If the ports, environment, or volumes keys land at the wrong indentation level, Compose silently ignores them and your service starts misconfigured. Our formatter normalizes indentation and the tree view confirms each key sits under the right service, so you catch nesting mistakes before docker compose up.

CI/CD pipelines

GitHub Actions, GitLab CI, and CircleCI all define workflows in YAML. Multi-document files, job matrices, and conditional expressions are easy to get wrong, and a broken pipeline blocks every deploy. Our formatter processes each --- separated document independently, while the diff view shows exactly what changed so you can review pipeline edits with confidence.

Ansible playbooks

Ansible tasks, handlers, roles, and inventories all live in YAML. Complex playbooks run hundreds of lines, and inconsistent indentation causes tasks to execute in the wrong order or against the wrong hosts. Our formatter keeps indentation uniform across the whole file, making large playbooks readable and maintainable for the entire team.

YAML guide

Understanding YAML

Everything you need to write clean, valid YAML — from first principles to best practices.

What is YAML?

YAML (YAML Ain't Markup Language) is a human-readable data serialization format used for configuration files. Unlike JSON, which uses braces and quotes, YAML uses indentation to express structure — making it far easier to read and write by hand. That readability is why it's the default configuration language across the DevOps ecosystem. This tool targets the YAML 1.2 specification.

Why YAML is so easy to break

YAML's readability comes at a price: it is extremely sensitive to whitespace. A tab instead of spaces, an inconsistent indentation level, or a missing space after a colon can cause a parse failure — or worse, a silent error where the parser reads your structure differently than you intended. A formatter solves this by normalizing indentation and validating syntax with precise error locations.

The basic building blocks

Scalars are simple values — strings, numbers, booleans, and null. Mappings map keys to values with colons. Sequences are ordered lists denoted by dashes.

# Scalars
name: John Doe
age: 30
enabled: true

# Mapping (key-value pairs)
person:
  name: Alice
  address:
    street: 123 Main St

# Sequence (list)
fruits:
  - apple
  - banana
  - orange

Advanced features: anchors and multi-document files

Anchors (&) mark a node for reuse and aliases (*) reference it — ideal for DRY configuration. Multi-document files hold several documents separated by ---, common in Kubernetes manifests. Tick Expand anchors in the formatter to resolve them into their full values.

# Anchors and aliases
defaults: &defaults
  timeout: 30
  retries: 3

service-a:
  <<: *defaults
  name: service-a

# Multi-document file
---
kind: Service
metadata:
  name: my-service
---
kind: Deployment
metadata:
  name: my-deployment

Multi-line strings: block scalars

YAML offers two block styles for long strings. The literal style (|) preserves every line break — use it for shell scripts, certificates, and ConfigMap data. The folded style (>) converts single line breaks into spaces — use it for long prose that should reflow. A chomping indicator (- or +) controls the final trailing newline.

# Literal (|): keep every newline
script: |
  #!/bin/bash
  echo "line 1"
  echo "line 2"

# Folded (>): single breaks become spaces
description: >
  This long description folds
  into one readable line.

# Chomping: strip or keep the final newline
folded_strip: >-   # no trailing newline
  text here
literal_keep: |+   # keep trailing blank lines
  text here

Best practices

  • Always use spaces for indentation — never tabs, and never mix levels.
  • Quote ambiguous strings like "true", "1.0", or version numbers to prevent type coercion.
  • Use comments liberally — YAML supports # comments.
  • Keep nesting shallow — deeply nested YAML is hard to read and error-prone.
  • Use anchors for repeated blocks instead of copying configuration.
  • Validate before committing — a YAML validator catches syntax errors before they reach production.

Type mapping

YAML to JSON data types

Every YAML value maps to a JSON equivalent. Here is the complete reference, in both directions.

YAML type YAML example JSON type JSON result
StringhelloString"hello"
Integer42Number42
Float3.14Number3.14
BooleantrueBooleantrue
Nullnull / ~Nullnull
Date2025-01-15String"2025-01-15"
Sequence- a
- b
Array["a", "b"]
Mappingkey: valObject{"key": "val"}

Conversion follows the YAML 1.2 spec — strings that look like yes, on, or numbers are quoted automatically so values round-trip exactly.

Real-world examples

DevOps configs, converted

Common configuration files, before and after conversion.

Kubernetes Deployment

YAML
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.25
        ports:
        - containerPort: 80
JSON
{
  "apiVersion": "apps/v1",
  "kind": "Deployment",
  "metadata": {
    "name": "nginx-deployment",
    "labels": { "app": "nginx" }
  },
  "spec": {
    "replicas": 3,
    "selector": {
      "matchLabels": { "app": "nginx" }
    },
    "template": {
      "metadata": {
        "labels": { "app": "nginx" }
      },
      "spec": {
        "containers": [
          {
            "name": "nginx",
            "image": "nginx:1.25",
            "ports": [{ "containerPort": 80 }]
          }
        ]
      }
    }
  }
}

Docker Compose

YAML
version: "3.8"
services:
  web:
    build: .
    ports:
      - "3000:3000"
    environment:
      NODE_ENV: production
    depends_on:
      - db
      - redis
  db:
    image: postgres:15
    volumes:
      - pgdata:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: myapp
  redis:
    image: redis:7-alpine
volumes:
  pgdata:
JSON
{
  "version": "3.8",
  "services": {
    "web": {
      "build": ".",
      "ports": ["3000:3000"],
      "environment": { "NODE_ENV": "production" },
      "depends_on": ["db", "redis"]
    },
    "db": {
      "image": "postgres:15",
      "volumes": ["pgdata:/var/lib/postgresql/data"],
      "environment": { "POSTGRES_DB": "myapp" }
    },
    "redis": {
      "image": "redis:7-alpine"
    }
  },
  "volumes": { "pgdata": null }
}

GitHub Actions workflow

YAML
name: CI
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18, 20]
    steps:
      - uses: actions/checkout@v4
      - name: Use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npm test
JSON
{
  "name": "CI",
  "on": {
    "push": { "branches": ["main"] },
    "pull_request": { "branches": ["main"] }
  },
  "jobs": {
    "test": {
      "runs-on": "ubuntu-latest",
      "strategy": {
        "matrix": { "node-version": [18, 20] }
      },
      "steps": [
        { "uses": "actions/checkout@v4" },
        {
          "name": "Use Node.js",
          "uses": "actions/setup-node@v4",
          "with": { "node-version": 20 }
        },
        { "run": "npm ci" },
        { "run": "npm test" }
      ]
    }
  }
}

Troubleshooting

7 Common YAML Errors (and How to Fix Them)

YAML's readability comes at a cost: whitespace sensitivity. Here are the seven errors developers hit most often — and exactly how to fix each one.

1. Tabs Instead of Spaces

YAML forbids tabs for indentation, but many editors insert them silently. The parser throws "found character that cannot start any token." Configure your editor to insert spaces ("editor.insertSpaces": true in VS Code) and use a YAML formatter to auto-detect tabs.

# BROKEN (tab indentation)
deployment:
→→name: my-app

# FIXED (spaces only)
deployment:
  name: my-app

2. Inconsistent Indentation Levels

Mixing 2-space and 4-space indentation confuses the parser about nesting, silently moving keys to the wrong level.

# BROKEN (mixed indentation)
server:
  host: localhost
    port: 8080   # nested under host instead of server

# FIXED
server:
  host: localhost
  port: 8080

3. Missing Space After Colon

Without a space after the colon, the whole pair is read as a single string instead of a mapping.

# BROKEN
name:John Doe

# FIXED
name: John Doe

4. Accidental Boolean Conversion (The Norway Problem)

In YAML 1.1, values like NO, YES, ON, and OFF are coerced into booleans — the infamous "Norway problem". YAML 1.2 fixed this by treating only true and false as booleans, but many parsers and legacy tools still use 1.1 semantics. Always quote ambiguous strings to stay safe across both.

# DANGEROUS in YAML 1.1
country: NO    # becomes boolean false

# SAFE
country: "NO"

5. Broken Anchors and Aliases

A typo in an alias name (*defalts instead of *defaults) fails the parse, while an unresolved merge silently drops keys. Validate that every *alias has a matching &anchor.

# BROKEN — typo in alias name
defaults: &defaults
  timeout: 30
service:
  <<: *defalts   # no matching anchor

# FIXED
defaults: &defaults
  timeout: 30
service:
  <<: *defaults

6. Multi-Document Separator Issues

Content after a ... end-of-stream marker is invalid, and a bare --- at the top starts a new document. Keep separators on their own lines.

# BROKEN — content after end-of-stream marker
---
first: doc
...
second: doc   # invalid, ... ends the stream

# FIXED
---
first: doc
---
second: doc

7. Unquoted Special Characters

Strings containing {}, [], :, &, *, or backslashes get misinterpreted. Double-quote them.

# BROKEN
path: C:\Users\name   # \U is a unicode escape

# FIXED
path: "C:\\Users\\name"

Real-World Impact

YAML errors cause real outages. A tab in a ConfigMap leaves a pod in CrashLoopBackOff; a yes parsed as a boolean makes a GitHub Actions condition always true; a misplaced ports key makes Docker Compose silently ignore it. The fastest fix: paste the file into an online YAML validator and get the exact line and column of the first error.

Comparison

YAML vs JSON vs TOML: Which Format Should You Use?

Three formats dominate configuration files. Here's a practical comparison to help you choose the right one for each job.

Feature YAML JSON TOML
ReadabilityExcellentGoodExcellent
CommentsYes (#)NoYes (#)
Anchors/AliasesYesNoNo
Whitespace-sensitiveYesNoNo
Multi-documentYes (---)NoNo
EcosystemDevOps, K8s, CI/CDAPIs, Web, JS/TSRust, Python

When to Use YAML

YAML dominates the DevOps and cloud-native ecosystem: Kubernetes manifests, Docker Compose, GitHub Actions, Ansible, OpenAPI, and Helm charts. Strengths: most human-readable for nested structures, supports comments, anchors, and multi-document files. Weaknesses: whitespace sensitivity leads to subtle bugs, and parsing is slower than JSON.

When to Use JSON

JSON is the universal data-exchange format: REST APIs, package.json, NoSQL databases, and native browser support. Strengths: fast to parse everywhere, strict unambiguous syntax, universal language support. Weaknesses: no comments, no anchors, verbose brackets and commas.

When to Use TOML

TOML (Tom's Obvious, Minimal Language) is rising in language ecosystems: Cargo.toml for Rust and pyproject.toml for Python. Strengths: clear section headers, less whitespace-sensitive, short spec. Weaknesses: awkward for deep nesting, smaller ecosystem, no anchors.

Scenario Recommendation
Kubernetes / Docker / CI/CDYAML
REST API payloadsJSON
Rust / Python projectsTOML
Complex nested configs with reuseYAML (anchors)
Flat, simple configurationTOML

Migrating Between Formats

JSON to YAML — remove brackets, replace commas with newlines, add indentation. YAML to JSON — add brackets, commas, and quotes. YAML to TOML — map nested keys to [table] sections. YAML to XML — map keys to elements. All are one click with our YAML to JSON, YAML to TOML, YAML to XML, and JSON to YAML converters.

# JSON input
{"server": {"host": "localhost", "port": 8080}}

# YAML output
server:
  host: localhost
  port: 8080

The Bottom Line

There's no single winner. YAML dominates DevOps and cloud infrastructure. JSON owns APIs and the web. TOML is rising in language ecosystems. If you work with Kubernetes, Docker, or CI/CD, YAML is unavoidable — make it easier with our YAML formatter, running entirely in your browser.

Why we built this

The YAML formatter we wish existed

Every YAML formatter we tried forced the same trade-off: paste our production configs into a server we don't trust, or click a "Format" button and wait. Neither fit how we actually work, so we built the tool we kept wishing for.

The breaking point was a late-night incident — a single stray tab in a Kubernetes manifest took a service down, and kubectl only said "error converting YAML to JSON" with no line number. We spent an hour hunting for a character we couldn't see.

That night shaped everything here: formatting that happens as you type, errors that point to the exact line and column, and processing that runs 100% in your browser — no upload, no account, no ads. Your configs never leave your machine.

It's free and open source because a YAML formatter is a tool every developer should have, not a product to be upsold. If it saves you even one late-night debugging session, it has done its job.

Why choose us

YAML Formatter vs. the alternatives

Most YAML tools do one thing at a time. Ours is a complete toolkit that works the moment you paste.

Feature YAML Formatter Typical alternatives
Real-time formatting Updates as you type Requires a click
JSON Schema validation Built-in tab Rarely offered
Tree view Collapsible hierarchy Rarely offered
Before/after diff Built-in tab Rarely offered
YAML ↔ JSON conversion One-click tabs Separate tools
YAML → TOML conversion Built-in tab Separate tools
YAML → XML conversion Built-in tab Separate tools
Anchor expansion One-click resolve Rarely offered
Error location Exact line & column Varies
Privacy 100% client-side Varies
Cost Free, no limits Freemium or ads

Everything runs in your browser — nothing is uploaded, no account required, no usage caps.

Frequently asked questions