Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

YAML Formatter

YAML

Paste YAML, or

CtrlV paste · Ctrl↵ run now

Formatted YAML
Ready
Ln 1, Col 1
Runs in your browser. Nothing you paste is uploaded unless you share it.

Re-indent YAML with 2 or 4 spaces

Clean up the indentation of a Compose file, a Kubernetes manifest or a CI workflow. Every value and comment stays as you wrote it; broken YAML gets the line, the column and the reason.

How to use it

  1. Paste YAML on the left, or open a .yaml or .yml file.
  2. Choose 2 or 4 spaces, whether list items sit under their key, and whether comments stay.
  3. Copy or download the result. An error is marked in your text with its line and column.

Examples

Re-indent a Compose service

Input
services:
   web:
      image: nginx:1.27
      ports:
      - "80:80"
Result
services:
  web:
    image: nginx:1.27
    ports:
      - "80:80"

A key written twice

Input
name: web
replicas: 2
name: api
Result

Line 3, column 1The key "name" is written twice in this map

Some parsers, PyYAML among them, keep only the last value without a word; here the second key is marked.

What formatting changes, and what stays as written

Only the layout changes: the indent, the space after a colon or a dash, spaces inside [ ] and { }, and runs of blank lines, which become one. The keys stay in their order and the values keep their text, quotes included.

Comments, anchors (&base) and aliases (*base), merge keys (<<), tags such as !Ref or !!binary, and the --- between documents all stay. Formatting twice gives the same text.

Folded text (>) is written on one line, which is how a parser reads it anyway.

Why no value changes

A formatter that reads YAML into data and writes it out again can change what the file says: 0755 may come back as 493 or 755, 9007199254740993 as 9007199254740992, and the comments are gone. This one reads every value as the text you typed, so ports, versions, IDs and file modes come out exactly as they went in.

Kubernetes, Compose and GitHub Actions files

Turn Indent lists off to write list items level with their key, as kubectl get -o yaml does; leave it on to indent them under the key. A file with several documents, such as a manifest with a Deployment and a Service, stays one stream.

Questions

Does it keep my comments?
Yes, each one beside the line it was on. Turn Comments off for a copy without any, for example before sharing a file.
Why does my YAML say Not valid YAML?
The status bar names the first problem with its line and column, and the spot is marked in your text. The usual causes are a tab used to indent, a key written twice, a bracket or quote left open, or a line indented one space off.
Is my YAML uploaded?
No. Everything runs in your browser, so your YAML stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. Config files, Compose files and CI workflows often hold passwords, tokens or keys, and the page warns you if it spots any.

Related tools