Skip to content

YAML format

Reformat a YAML document (or multi-document stream), or paste it in, into a deterministic, readable layout.

YAMLformatprettyreformat

Upload

Files (0–1)
One YAML document (or multi-doc stream), up to 2 MB, or paste it below.
Paste a YAML document instead of uploading a file. The same strictness applies as to an upload.

Options

Wrap long plain scalars at (columns) 0–4000
Questions people ask
What does "format" mean here?
The tool parses your YAML with a safe loader, then writes it back in PyYAML's block-style layout with your selected options (document markers, key order, wrap width, newline style). The parse + write is what makes this tool *deterministic*: the same input + same options produces the same output bytes, every time.
Are the values in the output the same as the input?
Yes, in the YAML value sense: every mapping, sequence, string, number, boolean, null and timestamp round-trips as the same Python value. The output parses to the same tree as the input. Numbers can have their spelling normalised (`1.50` becomes `1.5`), just like JSON; that is a format change, not a value change.
What does the tool *not* preserve?
Three things that live in the YAML text layer rather than in its value: (1) **Comments.** PyYAML's safe parser does not expose them, so a comment-only change cannot be defended as a value-preserving reformat. (2) **Scalar quoting style.** ``'hello'``, ``"hello"`` and a plain ``hello`` all parse to the same value; the dumper picks whichever form it needs based on the value's shape. (3) **Version directives.** A ``%YAML 1.2`` line is not part of the stream's value; the output does not carry one. All three are stated in the tool's result summary so a reader does not have to guess.
What happens with multi-document streams?
Each document is parsed, reformatted, and written with an explicit start marker; the documents keep their relative order. ``---`` separates them, and a trailing terminal marker (``...``) is not written.
Will it accept a document with ``!!python/apply`` or other risky tags?
No, and it will not "fail" the job either. A document that uses a tag outside the safe YAML set is not a processor fault; it is a content problem the tool cannot honestly reformat. The job completes, the status reads "Could not format", and a downloadable diagnostic names the offending tag with its line and column (``E_YAML_UNSAFE``). No object is ever constructed from it, so a hostile ``!!python/apply`` cannot run.
Does it fail on duplicate keys?
It will not reformat a document that repeats a scalar key, because YAML's practical reading is last-wins and silently collapsing two keys into one would hide a bug in the source. The job still completes: the status reads "Could not format" and a diagnostic carries `E_YAML_DUPLICATE_KEYS` with the offending key's line. It is a diagnostic, not a crash, exactly the stance the sibling YAML lint tool takes.
What does "Could not format" mean, versus an error?
This tool has three outcomes. Formatted (green): the document is safe YAML and you get the reformatted file. Could not format: the document is not safe or valid, whether unsafe tag, duplicate key, real syntax error, or not UTF-8, and you get a diagnostic explaining exactly why, with the position where the parser stopped. The job succeeded; no file was produced; nothing is fabricated. Processing failed (the genuine error case): a resource problem, such as the document being over the 2 MB cap; that is the platform, not your document, telling you it could not run.
Does anything leave my server?
No. The processor runs in an isolated container: no network access, no external DTDs, no external data. The PyYAML safe loader is the only YAML code that touches your document. The upload is deleted the moment the job completes; the result is kept for about 10 minutes.