Code Beautifier
tab characters must not be used in indentation

Fix YAML "tab characters must not be used in indentation"

YAML indentation must be spaces. Why the spec bans tabs, why editors insert them anyway, and how to find and replace every one.

Input that triggers it

server:
	host: example.com
	port: 8080
Open YAML Validator on its own page
Draft saved locally.

Local workspace

Named projects in IndexedDB · Local only — never synced to our servers. Worksp

Open manager

Batch workspace

Format multiple files locally in one run.

yaml
json

What the error means

YAML defines indentation in terms of spaces only. The specification forbids tab characters for indentation outright, because a tab has no fixed width — one editor shows it as two columns, another as eight — and YAML's structure depends on columns lining up exactly. tab characters must not be used in indentation means the parser found a tab where it was measuring the indentation of a line.

In the example, the two lines under server: begin with a tab. They look correctly nested in most editors and are rejected by every conforming parser.

Why it happens

  • The editor inserts tabs on the Tab key. Many editors do this by default for files whose type they do not recognise, and a .yml file with an unusual name or no extension is treated as plain text.
  • Copying from a terminal or a chat window that preserved a tab from the original source.
  • A Makefile habit. Makefiles require tabs, and people who write both often carry the muscle memory over.
  • Mixed indentation after a merge, where one side of the file used tabs and the other spaces. The tab lines look aligned but are not.

How to fix it

  1. Paste the file into the validator above. The error card gives the line and column of the first tab.
  2. Replace the tab with spaces. Two spaces per level is the common convention; what matters is that sibling keys use the same number.
  3. Search the whole file for remaining tabs — most editors accept \t in a search box — and replace them all in one operation. A file that had one tab usually has more.
  4. Set the editor to insert spaces for YAML: "Insert Spaces" or expandtab, plus an .editorconfig entry (indent_style = space) so the setting travels with the repository.

The corrected example, with spaces:

server:
  host: example.com
  port: 8080

If it still fails

  • A tab inside a value is allowed; only tabs in the indentation are not. If the error persists after replacing what you can see, String Inspector lists every tab and other invisible character with its exact position.
  • Some older parsers report the same problem as bad indentation of a mapping entry rather than naming the tab. If you get that message and the indentation looks right, check for tabs before anything else.
  • Files generated by a template engine may re-introduce tabs on every run; fix the template, not just the output.

Related errors