RunLocalTools

YAML Validator, Formatter & Converter — Private, Keeps Your Comments

Validate, lint, format and convert YAML in your browser. Line-numbered errors, comment-preserving formatting, JSON Schema checks and secret scrubbing. No upload.


What it does

Paste or drop a YAML file and get an immediate verdict: valid, or exactly which line and column is wrong. From there you can lint it for the traps that bite in real configs, reformat it without losing a single comment, convert it to JSON, .env, .properties or CSV, query it with a path expression, compare it with another file, check it against a JSON Schema, and mask anything that looks like a password or token before you share it.

You can keep several files open at once, work through a multi-document file (--- separated), and run a lint or format pass across all of them together.

How it works

The page loads a standard YAML 1.2 parser the first time you use it, and everything after that is calculated on your device.

  • Comment-preserving formatting. The file is parsed into a document tree that keeps comments attached to the keys they sit beside. Indentation, line width, quote style, key order and list style are changed on that tree and written back out, so comments survive. Before you can apply a result, the tool re-reads its own output and checks the data is identical to your original. If a sort would move an alias in front of its anchor, or a number would lose precision, the result is refused rather than offered.
  • The YAML 1.1 / 1.2 problem. Different tools read the same text differently. In YAML 1.1, NO, on and yes are booleans, 0755 is octal and 12:30 is a base-60 number. The linter flags every such value, and a table shows how each version reads it.
  • Line-aware schema checks. Your YAML is checked against a JSON Schema (draft-07), and every problem is mapped back to the line it came from, including “missing required property” and “unexpected property” cases.
  • Schema inference. The tool can write a draft-07 schema from your file: required keys, nullable values, date and email formats, and enums for repeated strings. That schema is then validated against your file, so you know it fits.
  • Path queries. A small query language (items[*].name, ..port, items[?(@.port>8000)]) finds values, or keeps only the matches, or removes them.

How to use it

  1. Paste YAML into the editor, or drop one or more .yaml, .yml, .json or .txt files on the right. Click Example to see the traps it catches.
  2. Read the Problems tab. Click any line to jump to it. Errors are in red, YAML-version traps in amber.
  3. Open Format, choose indent, quotes and sorting, and read the change preview. Apply it, copy it or save it as a new file.
  4. Use Convert for JSON, flat keys, .env, .properties or CSV; Explore for the tree, queries and search; Compare to diff against another document; Schema to validate; Secrets to scrub.
  5. Your open files are remembered in this browser. Use Clear saved files (or untick Remember my files) when you are done with anything sensitive.

If the output is a Docker Compose file, the Docker Compose visualizer draws how its services and networks connect. For .env output, the .env syntax validator double-checks quoting. If you only need a quick JSON ⇄ CSV ⇄ YAML round trip, the data format converter is lighter, and for comparing two JSON documents there is a dedicated JSON diff.

Supported formats

  • Input: YAML 1.2 (default) or YAML 1.1, single or multi-document; JSON (which is valid YAML); key=value lines for the flat-key reverse conversion.
  • Output: YAML, JSON (pretty or minified), dotted paths, Java .properties, .env, CSV, JSON Patch (RFC 6902) from the compare view, JSON Schema (draft-07), and plain-text reports.
  • Files: .yaml, .yml, .json, .txt, .env.

Limitations

  • Schemas: draft-07 is supported (draft-06 files that avoid draft-04-only keywords are treated as draft-07). Draft-04, 2019-09 and 2020-12 schemas are refused with a clear message instead of being checked wrongly.
  • Comments: formatting, resolving anchors and masking secrets keep them. Conversions, query results and schema output are data-only and do not carry comments.
  • Secret scanning is a heuristic. It catches common token formats and values under keys like password, but it cannot promise to find every secret. Read the result before you share a file.
  • Size: works comfortably up to a few megabytes. A 2.5 MB file takes a few seconds to analyse and about eight to format, so the Format preview only runs on request above 600 KB.
  • Numbers: integers beyond 2^53 and floats beyond about 15 digits cannot be held exactly by JSON or most tools. Formatting refuses to rewrite them, and JSON conversion warns.
  • Query language: one comparison or a chain joined with && / || inside a filter; no slices or functions.
  • Anchors and aliases: an excessive alias count (an expansion bomb) stops conversion with an error instead of freezing your browser.

Privacy

Your YAML is processed on your device. The page does not upload your files, and there is no account.

  • Local (always): parsing, linting, formatting, converting, querying, comparing, schema checks against a pasted or dropped schema, secret scanning, splitting and merging.
  • Downloaded once, sends nothing of yours: the YAML parser and the schema validator are fetched from a public CDN the first time they are needed. Your browser caches them afterwards.
  • Stored in your browser, not on a server: the files you have open and your settings, so a refresh brings them back. Untick Remember my files to stop this and delete the saved copies immediately, or press Clear saved files.
  • Optional internet, off by default: two steps need the network and each sits behind its own unticked checkbox with a notice. Fetch a YAML file from a URL requests the address you type. Load a schema from a URL or SchemaStore requests the schema address you give, the SchemaStore catalogue if you browse it, and any remote schemas a schema refers to. Only the requested address is contacted. Your document is never sent.

FAQ

Does formatting delete my comments?

No. Comments are attached to the keys they sit next to and move with them, including when you sort keys. Only conversions to other formats (JSON, CSV and so on) drop comments, because those formats have none.

Why is NO, on or 0755 flagged?

Older YAML 1.1 parsers read NO and on as booleans (the “Norway problem”: the country code NO becomes false), 0755 as octal, and 12:30 as a number. Modern YAML 1.2 parsers read all of these as text or decimal numbers. Because you often cannot tell which parser will read your file, the tool flags them and shows both readings. Quoting the value (“NO”) makes it text everywhere. GitHub Actions’ on: key is the well-known exception that works on purpose.

Which JSON Schema versions can I validate against?

Draft-07, which covers most configuration schemas. Schemas that declare draft-04, 2019-09 or 2020-12 are refused with an explanation rather than checked incorrectly. If a schema refers to other schemas by URL, tick the internet option for the schema step, or paste the referenced schema inline.

Is my YAML uploaded anywhere?

No. Your document stays in your browser. The only network use is the one-time download of the parser libraries and the two optional, unticked-by-default steps described under Privacy. If your config contains secrets, untick Remember my files so nothing is kept between visits, and use the Secrets tab to mask values before sharing.

What is the difference between YAML 1.1 and 1.2, and which should I pick?

Leave it on 1.2 unless the file is consumed by an older tool, such as some Ruby, Python (PyYAML) or Go (yaml.v2) libraries, that follows 1.1. Switching changes how values like yes, 0755 and dates are read, so the linter and the type table show you the effect immediately.

How big a file can it handle?

A few megabytes works well. Very large files are slower because everything runs in your browser, so the Format preview waits for a click above 600 KB.