Tabs in YAML – Fix Tab Indentation Errors

Local only

Tabs are not valid block indentation in YAML. A file that looks aligned in an editor can still fail when leading tabs are used instead of spaces.

31 chars · 3 lines

Waiting for input

Loading YAML parser…

YAML whitespace troubleshooting

Why tabs break YAML indentation

The validator above starts with a mapping whose child keys are indented by tab characters. Replace leading tabs with spaces before debugging application-specific settings because YAML block indentation is defined with spaces. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • YAML 1.2 parser validation
  • Duplicate mapping key detection
  • Preloaded broken YAML example
  • Readable parser feedback
  • .yaml and .yml file import
  • Browser-local processing

Steps

  1. Paste the failing YAML and inspect the parser error.
  2. Turn on visible whitespace in the source editor if the indentation looks correct.
  3. Replace leading indentation tabs with spaces and validate again.

Tabs can hide inside copied configuration

Editors often display a tab as several columns, so a tab-indented YAML file may look identical to one indented with spaces. Copying from terminals, documentation, or mixed editor settings can introduce them accidentally.

Do not replace tabs inside quoted values blindly

The problem is structural indentation. A tab that is intentionally part of a quoted string is data, so use an editor command that targets indentation rather than globally rewriting every tab character in the file.

Tab indentation example

The invalid version uses tab characters before name and port; the corrected block uses two spaces.

Invalid YAML

service:
	name: api
	port: 8080

Corrected YAML

service:
  name: api
  port: 8080

Common questions

Frequently asked questions

Are tabs allowed anywhere in YAML?

Tabs are not allowed for block indentation. They can appear in some scalar content, so avoid indiscriminate replacement inside data values.

Why does my YAML look correctly aligned even with tabs?

Editors expand tabs visually, but the YAML parser sees a tab character rather than the spaces required for block indentation.

Should I use two spaces or four spaces in YAML?

Either can be readable when used consistently. Two spaces is common, but consistency and correct nesting matter more than a specific width.

Debugging a specific YAML issue? Browse YAML troubleshooting.