YAML Formatter
Use the CaseSwitch YAML Formatter to re-indent YAML so GitHub Actions and Kubernetes snippets are reviewable. Paste YAML, choose Pretty or a compact dump, and copy the result. Parsing runs in this browser — nothing is uploaded.
Written by the CaseSwitch editorial team. We maintain these tools in the browser so drafts, keys, and images stay on your device.
Last reviewed: 23 July 2026
Processed locally in your browser. Nothing is sent to a server.
Paste or type text to convert. Output stays empty until there is input.
Character count: 0 · Word count: 0 · Line count: 0
Examples
Simple mapping
Input
name: app port: 3000
Output
name: app port: 3000
Compact dump (minify mode)
Input
name: app port: 3000
Output
name: app port: 3000
Nested server block
Input
server: host: localhost port: 8080
Output
server: host: localhost port: 8080
Normalize list indent
Input
tags: - a - b
Output
tags: - a - b
Boolean and null
Input
ok: true note: null
Output
ok: true note: null
How to use
- Paste YAML into the input panel.
- If you see a parse error, fix indentation and tabs in the source, then try again.
- Copy the dumped YAML. Quote boolean-looking strings before applying to a cluster.
What this tool is for
YAML’s indentation is meaning. A formatter that lies would be dangerous, so this page parses then dumps with consistent indent. Use it to clean a workflow fragment or teach why tabs vs spaces matter — not as a Kubernetes linter.
How it works
The document is parsed with a YAML loader, then emitted with js-yaml’s dumper (indent default 2). Pretty mode uses a comfortable line width. Minify mode dumps with `lineWidth: -1` for a more compact textual form — still YAML, not a binary encoding. Parse errors surface instead of guessing.
When to use it
Cleaning a workflow file snippet, reviewing a Helm values fragment, normalizing list indentation, and teaching YAML structure on a short sample.
When not to use it
Not a Kubernetes schema validator. The “Norway problem” and YAML 1.1 booleans (`NO`, `on`, `off`) still exist in some consumers — quote strings that must stay strings. Huge CRDs belong in the editor.
How it compares to related tools
JSON to YAML starts from JSON. JSON Formatter stays in JSON. Prefer JSON if your source of truth is already JSON.
Common mistakes
Mixing tabs and spaces until parse fails. Aligning comments until a value becomes a nested key. Shipping `NO` as a country code without quotes.
Quote strings that look like booleans
Some YAML 1.1 parsers still treat `NO`, `yes`, `on`, and `off` as booleans. After formatting, quote country codes and flag-like strings that must remain text. Prefer a quick read-through of enum-like fields before you apply a manifest.
Pretty vs compact dump
Pretty mode is for human review. Minify mode still emits YAML text via the dumper with a wide/disabled line wrap — it is not JSON minify. Prefer consistent indent for git diffs on workflow files.
Frequently asked questions
Did formatting change my types?+
YAML parsers infer types. `NO`, `on`, and numbers can surprise you. Quote strings that must stay strings.
Can I minify YAML like JSON?+
Minify mode dumps more compactly, but YAML is rarely minified like JSON. Prefer consistent indent for diffs.
Why did my list indentation change?+
The dumper normalizes nested list style (for example `tags:\n- a` → indented `- a`). Meaning stays; style matches the emitter.
Does this validate Kubernetes?+
No. It only parses and dumps YAML. Resource kinds and CRD schemas are unchecked.
Is my YAML uploaded?+
No. Parsing runs in this browser. Still avoid pasting live secrets into screenshots.
Are comments preserved?+
Parse-and-dump cycles typically drop comments. Re-add important comments after formatting if needed.
Does this tool send my payload to CaseSwitch?+
No. Formatting, encoding, and naming conversions for this page run in your browser after load — your sample stays on the device.
Related guides
Read our original articles on this topic.
Related tools
JSON to YAML Converter
Turning a JSON API example into a values.yaml draft, comparing the same data in two syntaxes, and preparing a workflow fragment from a JSON fixture. Validate Kubernetes kinds and apiVersions separately.
XML Formatter
Debugging an API that still speaks XML, cleaning an SVG you will edit by hand, reading a Maven pom snippet, and comparing two responses visually.
JSON Formatter
Debugging a 401 response, comparing two configs, preparing a gist, shrinking a JSON blob before embedding it in a test fixture, and checking whether a file is actually JSON before you commit it. If you need to escape a string as a JSON literal, use JSON Stringify instead. If you need YAML, use JSON to YAML after the JSON is valid.
JSON Stringify
Normalizing an API sample to a team indent, re-serializing a one-line fixture with 4-space indent, and checking that a paste is valid JSON before you commit it. If you only need pretty vs minify toggles, the [JSON Formatter](/json-formatter-minifier/) is the sibling tool. If you need to recover text from a quoted JSON string literal, use [JSON Unstringifier](/json-unstringifier/).
JSON Unstringifier
Cleaning a message copied from a JSON log line, extracting body text from a quoted fixture field, reversing accidental double wrapping when you only need the inner string, and teaching how JSON string escapes work.
CSV to JSON Converter
Fixture generation, prototyping a table UI, turning a small Sheets export into API-shaped JSON, and checking column names before wiring a mapper.