Free Online JSON to YAML Converter
Transform JSON objects into human-readable YAML syntax. Ideal for DevOps configs, Docker Compose, and Kubernetes with zero server uploads.
JSON input
YAML output
How to Convert JSON to YAML
Pick a direction.
Choose JSON → YAML or YAML → JSON at the top. Switching clears both editors, so paste your input after you choose.
Paste and convert.
Paste into the left editor, set the YAML indent to 2 or 4 if you need it, and click Convert. The result shows on the right.
Copy or swap.
Click Copy to take the result. Click Swap mode to move the output into the input and convert it back the other way.
Frequently Asked Questions
Answers about quoting, multi-line strings, comments, dates and errors when converting JSON and YAML.
How do I convert JSON to YAML?
Keep the JSON → YAML tab selected, paste your JSON into the left editor and click Convert. The YAML appears on the right with 2-space indents by default. Pick 4 in the YAML indent menu and click Convert again for wider indents.
How do I convert YAML to JSON?
Click the YAML → JSON tab, paste your YAML and click Convert. You get JSON with 2-space indents. If you just converted JSON to YAML, Swap mode moves that YAML into the input and converts it back for you.
Is YAML a superset of JSON?
Yes, for YAML 1.2. Any valid JSON is also valid YAML, so JSON pasted into the YAML → JSON tab parses too. YAML adds comments, anchors, block strings and keys without quotes, which is why the same data looks shorter in YAML.
Why are some values wrapped in quotes?
Some strings would change type if left bare. YAML readers can treat yes, on, true, null, 123 or 2024-01-01 as a boolean, number, null or date, so the converter puts those strings in single quotes. Real numbers and booleans from your JSON stay unquoted.
How are multi-line and long strings written?
A string with line breaks becomes a | block with one line per row; |- means there is no final line break. A string with spaces that runs past about 80 characters is folded across lines with >-. Both forms read back to exactly the same text.
What happens to comments, anchors and merge keys?
When you convert YAML to JSON, comments are dropped because JSON has none. Anchors (&), aliases (*) and << merge keys are expanded into full copies of the values. Converting back to YAML writes those copies out, not the anchors.
Why did my YAML date turn into a timestamp?
The parser reads an unquoted date as a date, and JSON stores it as a full timestamp, so d: 2024-01-01 becomes "2024-01-01T00:00:00.000Z". Put the date in quotes to keep it as text. Values like .inf and .nan become null, since JSON has no such numbers.
Why does my YAML show an error?
The common causes are tabs used for indentation, a key indented one space off, the same key twice, or several documents split by ---. The message names the line and column and shows the nearby lines. Only one YAML document can be converted at a time.
Can I choose 2 or 4 space indents?
Yes, for JSON to YAML. The YAML indent menu offers 2 or 4 spaces; click Convert again after changing it. With 4, list items holding objects put the dash on its own line. JSON output always uses 2 spaces.
Why is JSON to YAML slow on big files?
The tool sets no size limit, but large JSON to YAML jobs slow down fast. In our test of the same code, 0.7 MB took 0.2 seconds, 2.9 MB about 3 seconds and 7 MB about 15 seconds, and the page may stop responding meanwhile. YAML to JSON is quicker.
Is my data private when I convert JSON or YAML?
The conversion runs on your device with the js-yaml library, so your JSON and YAML stay in the page. Analytics record clicks like Convert and Copy and the time a run took. One caveat: when parsing fails, the error text sent to analytics can quote a few lines of your input.
JSON to YAML Features: Both Directions, Clean Output
Convert JSON to YAML or YAML to JSON with js-yaml, pick 2 or 4 space indents, and see parse errors with the line and column.

Convert JSON to YAML With Clean Indents
Paste JSON and click Convert to get block-style YAML: nested objects become indented keys and arrays become dash lists. Choose 2 or 4 spaces per level from the indent menu.
- 2 or 4 space indents
- Arrays written as dash lists
- Long text with spaces folded at 80 characters

Convert YAML to JSON and Back
Switch to YAML → JSON to turn a config file into JSON with 2-space indents. Swap moves the output into the input and converts the other way, so you can check a round trip.
- YAML to JSON with 2-space indents
- Swap flips direction in one click
- Anchors and merge keys resolved
Quotes Where YAML Needs Them
Strings that YAML could read as another type, such as yes, on, null, 123 or 2024-01-01, get single quotes in the output, so they stay text in any YAML reader.
Multi-Line Strings Kept Readable
A string with line breaks becomes a | block, one line per row, instead of one long line full of \n. Reading it back gives the same text, line breaks included.
Errors With Line and Column
If the input doesn't parse, you see the reason and where. YAML errors name the line and column and show the lines around it, such as a tab used for indentation.
Free, No Account Needed
There is no sign-up and no usage limit. The js-yaml library loads with the page, so each conversion runs on your device instead of on a server.
JSON to YAML Use Cases
Move config and API files between JSON and YAML when a tool reads only one of them.
Kubernetes & Docker
Turn kubectl JSON output or a JSON config into YAML you can commit as a manifest, or read a YAML manifest as JSON for a script.
- Convert kubectl get -o json output to YAML
- Edit Docker Compose files as JSON, then convert back
- Check Helm values as JSON before a deploy
CI/CD Config
Convert pipeline configs between JSON and YAML for GitHub Actions or other CI services. Comments in YAML are dropped when you convert to JSON, so keep a copy.
- Read a GitHub Actions workflow as JSON
- Spot a tab or bad indent by line
- Build YAML config from a JSON template
API Development
Switch an OpenAPI or AsyncAPI spec between JSON and YAML for the tool you use. A $ref stays a plain key; only YAML anchors are expanded.
- Turn an OpenAPI JSON spec into YAML
- Convert a YAML spec to JSON for code tools
- Round-trip a spec with Swap to compare
Explore More Tools
Discover other free tools that work great alongside this one
JSON Formatter
Format, validate and minify JSON in your browser
JSON to CSV
Convert JSON arrays to CSV spreadsheets
Diff Checker
Compare two texts side by side
Base64 Encoder
Encode and decode Base64 strings
Markdown to HTML
Convert Markdown to HTML with a live preview
Regex Tester
Test and debug regular expressions live