What This Tool Does
Paste YAML text or upload a file labeled YAML, YML, TXT. The tool parses the input before formatting it. When parsing succeeds without reported errors, the selected presentation rules are applied automatically and the result is shown. Detected errors include the document, line, and column where parsing stopped for that document.
What Gets Parsed
- Multi-document streams -
---document markers and...end markers, each document validated independently. - Block and flow mappings/sequences - indentation-based
key: valueand- itemstructures, plus{ }and[ ]flow collections. - Scalars - plain, single-quoted, double-quoted, literal (
|) and folded (>) block scalars. - Anchors, aliases and merge keys -
&anchor,*aliasand<<, with unresolved-alias detection. - Duplicate mapping keys - flagged as an error at the exact line of the second occurrence.
Errors and Parser Limitations
After validation, review the visible Documents, Errors, and Formatted output preview areas. The parser records one thrown YAML error per document, then continues to later documents. Each recorded error includes its document index, line, and column. Use Export errors to download the listed rows as CSV.
The custom parser reports errors for unsupported YAML directives such as %TAG and %YAML, complex mapping keys, tab indentation, and unresolved aliases. It can also show informational parser limitations when flow collections or some multiline scalars are preserved without internal reformatting. These limitations are not additional validation errors.
Formatting Options
Choose the output rules before editing or loading input. The defaults are 2 spaces, LF (Unix / Mac), Preserve as written, 1 maximum blank line, and Preserve declaration order. The controls also offer 4 spaces, CRLF (Windows), other quote styles, 0 or 2 blank lines, and Alphabetical (per mapping). Changing a setting automatically reformats the current usable input.
Comments and document boundaries (--- and ...) are preserved where the transformation allows it. Alphabetical ordering sorts mapping keys recursively; sequence item order is unchanged.
Quote Conversion and Value Limits
Quote conversion applies to scalars the custom parser resolves as strings. Recognized booleans, numbers, nulls, infinity, and NaN are not re-quoted. The parser has no separate date pattern, so date-like values may be treated as strings and affected by the quote-style setting. Prefer plain, where safe removes quotes only when the resulting plain token resolves to the same string under this parser. Flow collections and some multiline quoted or folded scalars may remain untouched.
How to Use the YAML Validator and Formatter
- Add your file: Paste YAML into Paste YAML content below, or drop/upload a YAML, YML, TXT file.
- Choose your formatting rules: Set indentation, line endings, quote style, blank lines, and key order.
- Validate: usable input is parsed and checked automatically.
- Review: Check Documents, Errors, any parser limitations, and Formatted output preview. Use Clear to remove the current input.
- Fix and export: Correct reported errors and the current input is checked again automatically. Use Export errors for the listed error rows. Export YAML becomes available only when no reported errors remain.
What This Tool Does Not Do
This tool does not repair invalid YAML semantics, remove data, fetch or validate external schemas, or convert YAML to JSON. For a JSON representation, use the YAML to JSON Converter after confirming validity. For content-level cleanup, use the YAML Cleaner. In the current page implementation, file reading, parsing, formatting, and downloads use browser-side APIs; the local code does not define broader account, server-policy, security-policy, or usage-limit terms.
Frequently Asked Questions
How is this different from the YAML to JSON Converter?
This tool stays in YAML the whole time. It checks syntax and applies presentation rules such as indentation, line endings, quote style, blank lines, and key order. A YAML to JSON Converter changes the representation of your data entirely, which this tool never does.
How is this different from the YAML Cleaner?
The YAML Cleaner performs content-level cleanup tasks. This tool is strictly a syntax validator and presentation formatter - it never removes data, never guesses at repairs, and reports parser problems instead of fixing them.
Will this tool change my values?
Quote conversion applies to scalars the custom parser resolves as strings. Recognized booleans, numbers, nulls, infinity and NaN are not re-quoted. Date-like values may be treated as strings and affected by quote-style settings. Flow collections and some multiline scalars may be preserved verbatim.
Can I export a file that has errors?
No. Export YAML is disabled while reported errors remain. Fix the source YAML; it is checked again automatically before exporting.