Example
Input (HTML)
<h1>yutils</h1> <p>A <strong>simple</strong> tool — converts <em>HTML</em> to <a href="https://yutils.dev">Markdown</a>.</p> <ul> <li>Headings</li> <li>Lists (nested OK)</li> </ul>
Output (Markdown)
# yutils A **simple** tool — converts *HTML* to [Markdown](https://yutils.dev). - Headings - Lists (nested OK)
Note
DOMParser builds an accurate HTML tree → recursive conversion. Attributes (class / style) and script / style tags are deliberately ignored. Verify the result with the Markdown Preview pair tool.
Usage / FAQ
When to use
- Convert web page or email HTML to Markdown for READMEs / blogs
- Move CMS-exported HTML to Notion / Obsidian / Markdown-based tools
- Tidy AI-generated HTML responses into Markdown
- Migrate legacy HTML docs to modern Markdown pipelines
- Pair workflow with Markdown Preview for round-trip verification
FAQ
- Q.Which HTML elements are supported?
- A.Headings (h1-h6), paragraphs, bold / italic / strikethrough, inline + block code, links, images, nested lists (ul / ol), blockquotes, horizontal rules, tables, line breaks. Wrapper elements like div / span are flattened to their content.
- Q.What about class / style attributes?
- A.Attributes without a direct Markdown counterpart (class / style / id) are dropped. Meaningful ones (href, src, alt, title) are preserved.
- Q.How are <script> tags handled?
- A.DOMParser parses without executing, so it's safe. Script and style contents are excluded from the output — zero XSS risk.
Fun facts
Markdown was created by John Gruber in 2004 as a plain-text → HTML conversion syntax. His design goal: 'Markdown is intended to be as easy-to-read and easy-to-write as is feasible.' The spec was loose enough that many dialects grew; CommonMark (2014) reintroduced a consistent spec.
Daring Fireball — MarkdownHTML → Markdown conversion is always lossy — Markdown's expressivity is a subset of HTML's. Inline styles, classes, nested tables, and custom data attributes either can't be expressed or get passed through as raw HTML. There's a trade-off between 'clean MD' and 'faithful to the source'.
CommonMarkThe most widely used HTML → MD library, turndown, was created by Mixmark Studios and has been active since 2017 — yutils uses turndown too. Options like heading style (`#` ATX vs `====` setext) handle dialect differences.
turndown on GitHub
Related guides
- Markdown Cheat Sheet — Every Common Syntax with Examples
A complete Markdown reference — headings, lists, links, images, tables, code blocks, footnotes, task lists, and the GitHub Flavored Markdown extras.
- How HTML Parsing Works
The HTML5 parser is famously forgiving — it recovers from missing tags, lets <br/> and <br> coexist, and never throws on malformed input. Here's the state machine behind that magic, why void elements exist, and how XML strictness compares.
Related tools
- JSON Formatter / Validator
Format, validate, and minify JSON strings. Adjust indent and optionally sort keys. Runs entirely in your browser.
- String Case Converter
Convert strings between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and Title Case — all six cases shown side-by-side.
- Regex Tester
Test JavaScript regular expressions with live match results. Supports g/i/m/s/u/y flags and capture groups.
- Markdown Preview
Render Markdown to HTML side-by-side. Supports CommonMark + GFM (tables, fenced code, task lists). marked is lazy-loaded.
- YAML ↔ JSON
Convert between YAML and JSON. Tolerates comments and multiline strings on the YAML side. yaml is lazy-loaded.
- Text Diff
Compare two texts and highlight added/removed lines, words, or characters.
- JSON Diff
Compare two JSON values, with optional key sorting and JSON-aware error messages.
- CSV ↔ JSON
Convert between CSV and JSON. Handles quoted fields, custom delimiters, and header rows.
- SQL Formatter
Format SQL queries with proper indentation and keyword casing. Supports PostgreSQL, MySQL, SQLite, and standard dialects.
- XML Formatter
Pretty-print or minify XML with attribute preservation. Handles SOAP, sitemaps, and config files.
- XML ↔ JSON
Convert between XML and JSON with attribute and element handling.
- Smart Paste
Paste any text and get tool recommendations — JSON, JWT, Base64, URL, UUID, Cron, and 9 more types auto-detected.
- Lorem Ipsum
Generate placeholder text in words, sentences, or paragraphs. Classic Lorem Ipsum or randomized.
- JSON Path
Query JSON with JSONPath expressions ($.store.book[*].author etc.) and inspect matches.
- JSON Schema Validator
Validate JSON data against a JSON Schema (Draft 2020-12). Powered by Ajv with format support.
- JSON Schema Generator
Generate a JSON Schema (Draft 2020-12) from a sample JSON. Infer types, required fields, and nested structures automatically.
- HTML Formatter
Beautify or minify HTML with proper indentation, attribute alignment, and configurable wrap.
- CSS Formatter
Beautify or minify CSS with proper indentation. Configurable selector and property style.
- JavaScript Formatter
Beautify or minify JavaScript with brace style and indent options. Powered by js-beautify.
- TOML ↔ JSON
Convert between TOML (Tom's Obvious Minimal Language) and JSON. Used in Cargo.toml, pyproject.toml, etc.
- INI ↔ JSON
Convert INI configuration to JSON and back. Supports sections, comments (; or #), and key=value.
- JSON → TypeScript
Generate TypeScript interfaces from a JSON sample. Nested objects become separate interfaces.
- JS Object → JSON
Convert a JavaScript object literal (unquoted keys, single quotes, trailing commas, comments) into standard JSON. Lenient parser, strict output.
- Slug Generator
Convert text into a URL-safe slug. Configurable separator, lowercase, and accent stripping.
- ASCII Tree
Convert indented text or path list into a box-drawing tree (├── │ └──).
- Diff Patch
Generate a unified diff (-u) patch from two text inputs. Compatible with `git apply` / `patch -p0`.
- Mock Data
Generate fake JSON records and SQL INSERT seed data — names, emails, custom fields, UUIDs, dates, and more. 0 dependency.
- MongoDB Extended JSON
Convert MongoDB Extended JSON (EJSON) between Canonical and Relaxed forms, or strip BSON wrappers to plain JSON. Recognizes 16 wrapper types ($oid/$date/$numberLong/$numberDecimal/$binary/...).
- Kubernetes YAML Visualizer
Paste Kubernetes manifests and see the resource graph — Deployments, Services, Ingresses, ConfigMaps, Secrets, PVCs, and how they connect. yaml is lazy-loaded.
- Docker Compose Visualizer
Paste docker-compose.yml and see services, networks, volumes, and depends_on as an interactive graph. Client-side, lazy-loaded yaml.
- PDF Text Extractor
Extract text from a PDF file — page by page or as a single document. Markdown-friendly output, all client-side.
- PPTX Text Extractor
Extract slide text from a .pptx file — plain / markdown / per-slide. Great for converting decks to markdown. All client-side.
- Regex Railroad Diagram
Visualize your regex as a railroad diagram — trace branches, groups, and quantifiers at a glance, in your browser.
- Word & Character Counter
Count characters (with/without spaces), words, sentences, paragraphs, lines, and bytes in real time — free, in your browser.