# YAML Formatter

> Validate and format YAML with 2-space indentation, convert YAML to JSON or JSON to YAML, and copy the result. Processed locally in your browser.

- Page: https://mondaytool.com/tools/yaml-formatter
- Category: developer-tools
- Price: free, no sign-up. Most tools run in the browser, so input is not uploaded.
- Use it: open https://mondaytool.com/tools/yaml-formatter. It is an interactive web page; this file is its documentation.

Last updated: 16 October 2026

## Validate, format and convert YAML

This **YAML formatter** checks that your YAML is valid and rewrites it with clean, consistent indentation. It can also convert YAML to JSON and JSON to YAML. Everything is processed locally in your browser.

## How to use it

1. Choose a tab: **Validate / Format**, **YAML → JSON** or **JSON → YAML**. An example is filled in for each.
2. Paste your own content into the input box.
3. Click the button: **Format YAML**, **Convert to JSON** or **Convert to YAML**.
4. Read the output and click **Copy**.

## How it works

The tool parses your input with the js-yaml library. If parsing fails, the error message is shown in red. If it succeeds, the data is written out again, which is what produces the formatting.

| Tab | Output |
| --- | --- |
| Validate / Format | YAML with 2-space indentation and no line wrapping |
| YAML → JSON | JSON indented with 2 spaces |
| JSON → YAML | YAML with 2-space indentation |

## Assumptions and limits

- Comments are not kept. The tool re-creates the YAML from the data, so comments in the input are dropped.
- Key order is kept, but quoting and list style may change to the library's defaults.
- Several YAML documents separated by `---` are supported. In YAML → JSON they become an array.
- The indentation is fixed at 2 spaces. There is no option to change it.
- Switching tabs replaces the input with that tab's example.

## Frequently asked questions

### Will formatting remove my comments?

Yes. Comments are not part of the parsed data, so they do not appear in the output. Copy them back by hand if you need them.

### Does it work with multi-document YAML?

Yes. Format mode keeps the documents apart with `---`. YAML → JSON returns a single value for one document, or an array for several.

### What happens if my JSON is invalid?

In JSON → YAML mode you get an "Invalid JSON" message with the parser's reason, and no output.
