Skip to tool
FeuTex · free tools runs in-browser no bloat built by LiMiT

YAML Formatter (VS Code)

Paste YAML to normalize indentation (spaces), trim trailing whitespace, and optionally add ---. You can also generate a ready-to-paste VS Code settings.json snippet for YAML formatting (Prettier or Red Hat YAML).

Note: This formatter is a fast indentation normalizer (heuristic). For full YAML-aware formatting in VS Code, use an extension formatter and “Format Document”.

Category: Developer · URL: /tools/yaml-formatter-vscode.html
Privacy: runs locally in your browser. No network requests.
Privacy: runs locally in your browser. No uploads, no tracking scripts.

How to use

Use it in two ways: format YAML text, or generate VS Code formatter settings.

  1. Paste your YAML into the input.
  2. Select indentation (2 or 4 spaces) and toggles (tabs, trim, ---).
  3. Click Format YAML to normalize indentation.
  4. Or pick a formatter and click Generate VS Code settings to get a settings.json snippet.
  5. Click Copy Output to copy the result.
Keywords this page targets (natural cluster): yaml formatter vscode, vscode yaml format on save, yaml pretty print vscode, yaml indentation fixer, format yaml online for vscode, vscode settings yaml formatter, prettier yaml vscode settings, redhat yaml extension formatter, convert tabs to spaces yaml, yaml normalize indentation, yaml lint indentation, add yaml document start ---, yaml trailing whitespace remover, vscode default formatter for yaml, why vscode not formatting yaml, yaml formatter settings.json snippet, yaml format document vscode, prettier tabWidth yaml
Secondary intents covered: Format messy YAML indentation into consistent 2 or 4 spaces, Convert tabs to spaces for YAML compatibility, Trim trailing whitespace and normalize line endings, Add a YAML document start marker (---) when needed, Generate a VS Code settings.json snippet to enable YAML formatting, Choose between Prettier and Red Hat YAML as the VS Code YAML formatter, Copy formatted YAML or settings snippet quickly

FAQ

Which VS Code extension should I use to format YAML?

Prettier is a common choice for consistent formatting across file types; Red Hat YAML is great for YAML support and schema validation. This page can generate a settings.json snippet for either.

Why does YAML formatting fail in VS Code?

Usually there’s no default formatter set for [yaml], or another extension is taking precedence. Set [yaml].editor.defaultFormatter and enable format on save.

Does this tool fully parse YAML?

No. It’s a fast indentation normalizer that keeps your line content and re-maps indentation levels; complex YAML edge cases may require a real formatter in VS Code.

Will it convert tabs to spaces?

Yes. Enable “Convert tabs to spaces” to replace tabs with your selected indent size, which helps avoid YAML indentation issues.

Can it add the YAML document start marker (---)?

Yes. Enable the option to insert --- if the first non-empty, non-comment line isn’t already --- or ....

Does it change key order or rewrite values?

No. It only adjusts indentation and whitespace (plus optional ---), so it won’t sort keys or change scalars.

Is my YAML sent to a server?

No. The formatter runs entirely in your browser and does not make network requests.