Shiklo Tools
PDF40
Image20
Calculators & Converters25
Text & Writing13
Developer26
Video14
Audio14
Document14
Data & Spreadsheet12
Web & SEO9
OCR & Scanning5
Archive & File12
Security & Privacy23
Health & Medical29
QR & Barcode5

YAML Formatter

Validate and format YAML with exact error lines, keep comments, and convert YAML to JSON or JSON to YAML. For Kubernetes, Compose and CI files.

YAML is easy to read but easy to break: one wrong indent or a missing space after a colon, and a deployment fails. The YAML Formatter checks your YAML as you type, shows the exact line and column of any error, and reformats the file with consistent indentation while keeping your comments. It handles files with several documents separated by three dashes, such as Kubernetes manifests.

It also converts YAML to JSON and JSON to YAML in one click. Use it for Kubernetes, Docker Compose, GitHub Actions, GitLab CI, Ansible, OpenAPI and application config files. Everything runs in your browser, so secrets in your config never leave your device.

How to use YAML Formatter

  1. Paste your YAML, open a .yaml or .yml file, or click Sample.
  2. Read the status: valid YAML (with the number of documents) or the error with its line and column.
  3. Choose 2 or 4 spaces of indent and whether to prefer single quotes.
  4. Copy or download the result, or click YAML → JSON or JSON → YAML to convert.

Features

  • YAML validator with the exact line and column of each error.
  • Formatting with 2 or 4 spaces; comments are kept.
  • Multi-document files (separated by ---) validated and formatted.
  • YAML to JSON: one document becomes an object, several become an array.
  • JSON to YAML: paste JSON and get clean block-style YAML.
  • Option to prefer single quotes for strings that need quotes.
  • Live checking as you type up to 300 KB.
  • Private: secrets and config never leave your browser.

Common YAML errors and how to fix them

Most YAML errors come from whitespace. The validator stops at the first problem and shows its line and column; these are the usual causes.

ErrorCauseFix
Bad indentation of a mapping entryA key is indented by a different number of spaces than its siblingsLine keys up with the others at the same level
Tab charactersYAML does not allow tabs for indentationReplace tabs with spaces
Missing space after colonkey:value is read as one plain stringWrite key: value with a space
Duplicated mapping keyThe same key appears twice in one mapRemove or rename one of them
Unexpected end of the stream or deficient indentationA quote or bracket is not closedClose the string, [ list or { map

What formatting changes

The formatter uses Prettier's YAML printer. It re-indents nested maps and lists to the chosen width, normalises spacing around colons and dashes, tidies inline lists and maps, and uses consistent quotes. Comments, the order of keys, anchors and aliases, and multi-line block strings are kept. The data itself does not change, so the formatted file loads into exactly the same values as the original.

YAML to JSON and back

YAML is a superset of JSON for most practical purposes, so any YAML data can be written as JSON. Click YAML → JSON to see exactly what a program will read from your file: this is a quick way to check that a value you meant as text is not read as a number or a boolean. This tool follows YAML 1.2, where only true and false are booleans; older YAML 1.1 parsers (used by some tools) also read yes, no, on and off as booleans. Values such as 1.10 and 0123 are read as the numbers 1.1 and 123, so put them in quotes if they should stay text. JSON → YAML does the reverse and is handy for writing config files from API output. Comments cannot be represented in JSON, so they are dropped when converting.

Multi-document files

A YAML file can hold several documents separated by a line with three dashes. Kubernetes uses this to put a Deployment, a Service and a ConfigMap in one file. The validator checks every document and the status shows how many it found. When you convert to JSON, a single document becomes one object, and several documents become a JSON array with one item per document.

Kubernetes, Compose and CI files

The formatter checks YAML syntax, which is the cause of most failed deployments and pipeline runs. It does not check the schema of a specific tool, such as whether a Kubernetes field name is spelled correctly or a GitHub Actions key exists. Validate syntax here first, then use the tool's own linter (for example kubectl with dry-run, or actionlint) for schema checks.

Frequently asked questions

Is the YAML formatter free and private?

Yes. It is free with no sign-up. YAML is validated and formatted in your browser, so passwords and tokens in config files are never uploaded.

Are comments kept when formatting?

Yes. Formatting keeps comments, key order, anchors and aliases. Only converting to JSON drops comments, because JSON has no comments.

Can I use tabs in YAML?

No. The YAML standard forbids tabs for indentation. Replace them with spaces; the validator shows the line where a tab was found.

Does it support multiple documents?

Yes. Documents separated by --- are all validated, the status shows how many there are, and they convert to a JSON array.

Why does 1.10 or 0123 change in the JSON?

Unquoted values are read by type: 1.10 becomes the number 1.1 and 0123 becomes 123. Quote values such as versions and codes that must stay text.

Does it validate Kubernetes or GitHub Actions schemas?

It checks YAML syntax only, which catches indentation and quoting mistakes. Field names specific to a tool are not checked.

How do I convert JSON to YAML?

Paste the JSON into the input and click JSON → YAML. The result uses 2-space block style without line wrapping.

Related tools