Skip to content

Install ALink Tools

Free browser tools for images, PDFs, media, text and web checks. Most tools process files locally on your device.

  1. Tap the Share button in the Safari toolbar.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. ALink Tools then opens from your Home Screen like an app.

YAML Formatter

Paste YAML and get a formatted or compact copy in this tab. js-yaml parses it with the same default schema as YAML to JSON. Comments and some tags are not preserved. Nothing is uploaded.

Runs in your browserjs-yaml (MIT)Runs in your browserNothing is uploaded
1

YAML

2

Formatted YAML

How to use YAML Formatter

  1. Paste or open YAMLType, paste, or open a .yaml or .yml file. The limit is 2 MB of text, or 8 MB if you load a file.
  2. Choose format optionsPick an indent of 2 or 4 spaces, compact flow style, or key sorting. Turn on “all documents” if the file uses --- separators.
  3. Copy or downloadCopy the result or download formatted.yaml. If the YAML is invalid, the error from js-yaml is shown instead.

Limits and how it works

  • The input is limited to 2 MB of UTF-8 text (8 MB if you load a file). Larger files can run out of memory in a phone browser tab.
  • Comments are dropped. Custom tags and some merge-key cases are not supported.
  • Anchors are resolved when the file is read. The output expands aliases instead of keeping the original anchor names (js-yaml dump uses noRefs).
  • A syntax error is reported with the message from js-yaml; the file is not repaired automatically.

What this formatter changes

This page formats YAML. It does not convert YAML to JSON; use YAML to JSON for that, or JSON to YAML to go the other way.

Formatting uses js-yaml (MIT) with the default schema already used on YAML to JSON. Unquoted true and false become booleans. Unquoted yes, no, on, and off stay text, and are written in quotes so other YAML 1.1 parsers do not read them as booleans. The text is parsed and written back, so comments, original anchor names, and custom tags are not kept.

Compact mode writes flow-style YAML (braces and brackets). Block style with 2- or 4-space indent is the default pretty-print.

Frequently asked questions

Is my text or file uploaded?

No. Everything runs in your browser tab with JavaScript. Nothing you type, paste or drop is sent to a server, logged or stored by ALink Tools.

Why did my comments disappear?

js-yaml parses YAML into values and dumps them again. Comments and some styling are not part of that data and cannot be written back.

Can I format several documents at once?

Yes. Turn on “all documents” and a --- separated stream is formatted document by document.

Is this the same as YAML to JSON?

No. That page converts to JSON. This page writes YAML back out, with indent, compact, and sort-key options.

Related tools

All tools