Menu
PDF Tools
Image Tools
Converters & Utilities
Seller & Print Tools
Accounting & Business
Calculators
Text & Writing Tools
Developer & Web Tools
Creator & Social Tools
Browser Utilities & Games
Document & Design Makers
Text & Developer Tools
Exam & Form Tools

YAML Formatter

This tool formats and checks YAML. It sets a clean indent, can sort keys and wrap lines, keeps comments and shows the line of an error.

How to use YAML Formatter online

  1. Paste the YAML. Type or paste the text.
  2. Choose the layout. Indent, sorting and line width.
  3. Read the result. The formatted YAML or the error appears.
  4. Copy it. Copy or save the result.

Why use this free YAML Formatter

  • Checks the syntax
  • Line and column of errors
  • Indent of 2 or 4
  • Optional key sorting
  • Comments kept
  • Share by link

What it does

YAML is a data format used for configuration files, such as those for Docker Compose, Kubernetes and CI systems. It relies on indentation, so untidy files are hard to read and easy to break. Paste your YAML, and the tool checks it and writes it again with a consistent layout.

Checks and errors

If the YAML cannot be read, the tool shows the first error with its line and column, for example a missing bracket or a wrong indent. Remember that YAML allows spaces only, not tabs, for indentation. Fix the first error and the tool shows the next one, if any.

A worked example

The sample has uneven spacing, a list indented by four spaces and an object in braces. After formatting with an indent of 2 it reads:\nname: My App version: 1.2 items:

  • one
  • two config: { debug: true, level: 3 }\nThe file has 6 lines. Comments in the original stay where they were.

Options

Choose an indent of 2 or 4 spaces. Sort the keys alphabetically to make files easier to compare. Wrap long lines at 80 or 120 characters, or never. You can also ask for short lists and objects to be written on one line, in the flow style, which makes the file shorter.

Things to know

The tool changes the layout and not the data. It follows the YAML 1.2 rules, so some old values are read differently than in older tools; for example, yes and no are plain words and not true and false. Anchors and aliases are kept. For converting to and from JSON, use the YAML and JSON converter.

Using the tool

The YAML Formatter works again whenever the text or an option changes. Press Try a sample to see how it behaves.

YAML Formatter: frequently asked questions

Can YAML use tabs for indentation?
No. Indentation must use spaces.
What happens to comments in the YAML?
They stay in place.
Does formatting change the data?
No, only the layout.
How do I sort keys?
Switch on the sort option.
Does it find errors?
Yes, with the line and column of the first one.
Is the text I paste into the YAML Formatter uploaded?
No copy is made on a server; the YAML Formatter runs in your browser.
How do I keep the result of the YAML Formatter?
Save the YAML Formatter result as a text file, or copy it from the result box.

Related searches for YAML Formatter

  • YAML Formatter online
  • free YAML Formatter
  • YAML Formatter online free
  • YAML Formatter for mobile
  • YAML Formatter without sign up
  • YAML Formatter – Text & Writing Tools

YAML Formatter is a free online tool on MAITBOX, in the Text & Writing Tools group. It runs in your browser, so what you type is not sent to a server. It works on Android and iPhone, and on Windows, Mac and Linux, with no download and no account.

More tools in Text & Writing Tools →

Search tools