# YAML Formatter

URL: https://phishdestroy.io/developer-tools/yaml-formatter
Category: General dev
Where it runs: Runs locally (nothing you enter is uploaded)

Normalise irregular indentation in a YAML file to two or four spaces per level, for example after combining snippets from different sources.

## Example input

Four-space config

```
server:
    host: 127.0.0.1
    port:    8080
    tls:
        enabled: true
```

Every level is re-indented to two spaces, and port:    8080 becomes port: 8080.

## FAQ

### Does it validate YAML?

No. It works line by line without parsing, so unclosed brackets, bad quoting or duplicate keys are not reported; the only warning is for a list item with nothing after the dash. Check the result with a YAML parser before relying on it.

### How is the new indentation worked out?

The smallest indentation on the earlier lines counts as one level, and each line's depth is its indentation divided by that step, rounded. Comment lines keep their original indentation, runs of spaces after a colon are collapsed even inside quoted values, and block strings (| or >) can shift, so compare before and after.

### Is the YAML sent anywhere?

No. Formatting runs in your browser, and nothing is uploaded.

## Related tools

- [JSON ↔ YAML Converter](https://phishdestroy.io/developer-tools/json-yaml-converter)
- [YAML to TOML Converter](https://phishdestroy.io/developer-tools/yaml-to-toml)
- [XML Formatter](https://phishdestroy.io/developer-tools/xml-formatter)
- [JSON Formatter](https://phishdestroy.io/developer-tools/json-formatter)
- [Docker Run to Compose Converter](https://phishdestroy.io/developer-tools/docker-run-to-compose)

All tools: https://phishdestroy.io/developer-tools
