YAML Formatter

Convert stray tabs to spaces and strip trailing whitespace, line by line

This tool only normalizes whitespace, it converts tabs to 2 spaces and trims trailing spaces per line. It does not re-indent, reorder, or validate YAML structure.

Input

Formatted output

Nothing you paste here is ever uploaded, formatting happens entirely in your browser.

About this tool

YAML is whitespace-sensitive, which makes tabs and stray trailing spaces a common, hard-to-spot source of parsing errors, most YAML parsers reject tabs used for indentation outright. This tool does exactly two things, on purpose: it converts every tab character into 2 spaces, and it removes trailing whitespace from the end of each line. It deliberately does not re-indent your structure, reorder keys, or validate the document, so what you get back is your original YAML with just its whitespace hygiene cleaned up.

Why doesn't this re-indent or validate my YAML like a real formatter?

Because YAML's indentation carries structural meaning, safely re-indenting it requires actually parsing the document into a tree first, get that wrong and you can silently change what the file means. This tool intentionally stays simple and only touches whitespace characters, so it can never alter your document's structure or values.

Why are tabs a problem in YAML specifically?

The YAML specification disallows tab characters for indentation, so a file with tabs will often fail to parse in strict YAML implementations even though it might look fine in an editor. Converting tabs to spaces up front avoids that entire class of error.

Is trailing whitespace really worth removing?

On its own it's usually harmless, but it's invisible in most editors, bloats diffs when a file is checked into version control, and can occasionally interact badly with block scalars. Stripping it is a cheap, safe cleanup step with no downside.