Docker Compose YAML Formatter
Clean up a messy docker-compose.yml by normalizing indentation to a consistent 2- or 4-space step and tidying list-item dashes. Runs entirely in your browser — nothing is uploaded.
Input
Output
Guides
Paste a docker-compose.yml and get it back with clean, consistent indentation. This formatter normalizes messy or mixed spacing — a service indented two spaces here, six spaces there — into a uniform 2- or 4-space step, tidies list-item dashes, strips trailing whitespace, and normalizes Windows line endings. It runs entirely in your browser, so your compose file never leaves your machine.
How to use it
- Paste your compose file into the input box, or upload a
docker-compose.ymlwith the file picker. - Choose an Indent Size — 2 spaces (the Docker convention) or 4 spaces.
- The formatted result appears instantly on the right. Copy it, or download it straight back as
docker-compose.yml.
There are no options to configure beyond indent size, and nothing to install. The tool re-formats as you type.
What it does
- Uniform indentation. It tracks the nesting depth of every line and re-emits each one at a consistent multiple of your chosen indent size, so inconsistent source spacing collapses to one clean step.
- Tidy list markers. Sequence entries like
-valueor- valueare normalized to a single- valueprefix. - Whitespace cleanup. Trailing spaces are trimmed and
\r\n/\rline endings become plain\n.
FAQ
Does it validate my compose file against the Compose Spec?
No. This is a formatter, not a linter. It focuses on reliable, structure-preserving indentation cleanup and does not check service keys, restart policies, image references, or depends_on targets. For full validation, run docker compose config locally against your file.
Will it reorder my keys into the Compose convention?
No. Reordering keys safely requires a full YAML parser and a faithful serializer (correct quoting of values like "3000:3000" or "1", block scalars, anchors, and so on). To avoid any risk of corrupting your file, the formatter preserves your key order exactly and only normalizes whitespace and indentation.
Does it handle multi-line block scalars and flow-style collections?
It treats them as text. Inline flow collections (ports: ["80:80"]) and block scalars (command: |) are re-indented at the line level but not re-parsed, so their internal formatting is left untouched.
Which indent size should I pick?
Two spaces is the near-universal convention for Docker Compose files and matches the examples in Docker's own documentation. Four spaces is offered for teams whose style guides prefer it.
Is my compose file uploaded anywhere?
No. All formatting happens locally in your browser using plain string processing — nothing is sent to a server, logged, or stored. You can even use it offline once the page has loaded.