HTML to YAML Converter Online — Free & Private

Paste HTML and get YAML output. Everything runs in your browser and nothing is uploaded.

Loading…
HTML → YAML for markup you want to inspect as a tree
Reads HTML with the browser parser and writes the element tree as YAML, with attributes and text under their own keys.

Developer notes

Attribute names get a @ prefix, such as @href. Text that sits next to attributes or child elements goes under #text. A fragment with one root element starts with that tag. Several top-level nodes are grouped in a body list, and a document title adds a title key. The HTML parser ignores a self-closing slash on tags it does not know, so the siblings after such a tag end up inside it. Write a closing tag for each custom element. Attribute values are text, but the YAML writer leaves numbers and booleans unquoted. Double-quote all strings keeps them as text.

Use cases

Inspect a fragment of a page as a tree before you write a scraper. Compare the structure of two HTML snippets as YAML in a diff. Turn a navigation block into data for a config file.

About these options

CSV exports: choose a delimiter (Auto follows locale — semicolon on /fr), RFC-minimal vs always-quoted fields, line endings, and whether to emit a header row. CSV imports: delimiter is auto-detected from the first line (comma, semicolon, tab, or pipe) — toggle whether row 1 holds column names. JSON output (XML, YAML, or CSV sources): indentation (including compact one-line) and optional recursive key sort. JSON → XML: toggle pretty-printing and indent width. YAML output: indent width, readable vs tighter layout, and deterministic string quoting (there is no source YAML file to “preserve”). XML comments are not represented in the intermediate JSON tree.

Examples

Attributes and repeated elements

Input

<nav class="menu" id="main"> <a href="/">Home</a> <a href="/tools" class="active">Tools</a> <a href="/blog">Blog</a> <a href="/about">About</a> </nav>

Output

nav: @class: menu @id: main a: - @href: / #text: Home - @href: /tools @class: active #text: Tools - @href: /blog #text: Blog - @href: /about #text: About

Several top-level nodes

Input

<h1>Status</h1> <p>All systems normal.</p>

Output

body: - h1: Status - p: All systems normal.

Related tools

Other converters that start from HTML are linked on this page.

HTML → YAML FAQ

How the tree is written

How are attributes written?

Each attribute becomes a key with a @ prefix, for example @href. Text next to attributes goes under #text.

What happens with several top-level nodes?

They are grouped in a body list. A document title adds a title key.

Why do numbers appear without quotes?

Attribute values are text, but the YAML writer leaves numbers and booleans unquoted. Choose Double-quote all strings to keep them as text.

Is my data sent to a server?

No. The conversion runs in your browser, and FastMinify never receives what you paste.

Convert HTML to JSON, XML, YAML and Markdown.