Encited logo
PricingTalk to sales

HTML to Markdown

HTML to Markdown converter

Paste HTML or enter a URL and get clean Markdown, with headings, links, lists, tables and code blocks. Pasted HTML is converted in your browser.

HTML354 B
Markdown237 B
Smaller by33%
Markdown sizeapproximate60 tokens

Markdown

# Trail Runner 2

A lightweight trail shoe for runners with **wide feet**.

- 5 mm lugs for grip on wet rock
- Rock plate under the forefoot

| Size | Weight |
| --- | --- |
| EU 42 | 270 g |

[Size guide](https://example.com/size-guide)

How to convert HTML to Markdown

  1. Paste HTML or enter a URL

    Paste a snippet or a whole page, or enter a URL to convert a live page.

  2. Read the Markdown

    Pasted HTML converts as you type, in your browser. A URL is fetched first, then converted.

  3. Render JavaScript pages

    For a page built by JavaScript, press Render the page first to convert the content a browser sees.

  4. Copy or download

    Copy the Markdown or download it as a .md file.

How HTML elements map to Markdown

Headings
<h1> to <h6> become # to ###### headings.
Emphasis
<strong> and <b> become **bold**, and <em> and <i> become _italic_.
Links and images
<a href> becomes [text](url) and <img> becomes ![alt](src).
Lists
<ul> and <ol> become - and 1. lists, with nested lists indented.
Tables
<table> becomes a GitHub-flavored pipe table, with the first row as the header.
Code
<pre><code> becomes a fenced code block, and inline <code> becomes `code`.
Removed
Scripts, styles, iframes and the page head are dropped. For a whole page, only the <main> or <article> element is converted when the page has one.

Markdown for AI agents

The As AI agents get it view shows the format Encited serves to AI agents. It differs from standard Markdown in four ways:

Page chrome removed
Navigation, forms, buttons, dialogs and the site header and footer are dropped, so only the page's content is left.
Readable links
Links are written as text (url), and a list of links as text: url, which a model reads without Markdown syntax.
A header block
The page's title, URL, description and language at the top.
Structured data
The page's JSON-LD at the end, so prices, ratings and stock stay attached.

Convert HTML to Markdown in JavaScript or Python

JavaScript (Turndown)
import TurndownService from "turndown";

const turndown = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
const markdown = turndown.turndown("<h1>Hello</h1><p>World</p>");
Python (markdownify)
# pip install markdownify
from markdownify import markdownify

markdown = markdownify("<h1>Hello</h1><p>World</p>", heading_style="ATX")

HTML to Markdown FAQ

Open the From a URL tab and enter the page's address. The tool fetches the HTML and converts it. If the page builds its content with JavaScript, press Render the page first.

Pasted HTML is converted in your browser and isn't sent anywhere. A URL is fetched by our server, because browsers can't read other sites' HTML directly, then converted.

The Standard view gives CommonMark with GitHub-flavored tables: ATX headings (#), fenced code blocks, - for list items, [text](url) links and pipe tables. The As AI agents get it view gives the format Encited serves to AI agents.

Tables become pipe tables with the first row as the header. Nested lists keep their nesting with indentation.

In JavaScript, Turndown is a widely used library, and this tool is built on it. In Python, markdownify does the same job. The examples above show both.

Most Markdown renderers, including GitHub's, pass raw HTML through. Converting to Markdown removes it, which is why the output is smaller and easier for an AI model to read.

An AI model reads a page inside a limited context window. Markdown keeps the headings, lists, tables and links and drops the markup, so the same content takes fewer tokens. The size numbers above show the difference for your page. Read more in do AI crawlers render JavaScript.

Yes. It's free and you don't need an account.

More free SEO tools

“Encited has become my go-to for all Lovable projects. I saw an uptick in crawls almost immediately after switching. Honestly one of the best dev/SEO tools I’ve used. Aki was also amazing on support. Love it!”
Kyle Davidson
Kyle Davidson
Co-founder at Shoutout.io
Trusted by over 5,000 brands and agencies
Shoutout.io
Optimum Service Marketing
Brilus
Local Marketing Vault
API Worx
Main Street Marketer
AI-native markdown

Serve your pages in AI-optimized markdown

An agent reads your page inside a context window it shares with the question and every competitor page it pulls in. Each snapshot is post-processed into lean HTML for search engines and Markdown for AI agents, so your specs, prices and reviews make it into the answer.

  • Specs, prices and reviews stay intact for AI answers
  • Same URL for every agent, no separate feed to maintain
  • Lean HTML for search engines from the same snapshot
Book a demo

Tokens per format

/products/alpine-trek-gtx

  • Rendered pageWhat a headless browser sees21,400
  • Lean HTMLGoogleBingServed to search engines7,900
  • MarkdownChatGPTClaudePerplexityServed to AI agents2,650

GET /products/alpine-trek-gtx

Accept: text/markdown

200 text/markdown · 18ms from the edge

Avatar
How can we help?
Get instant answers to your questions or leave a message for an engineer will reach out
Ask AI about Encited
See our docs
Contact support
Leave a message
We'll get back to you soon
Avatar
Ask AI about Encited
Product questions, troubleshooting and
Thinking
Preview
Drop an image to attach
Powered by ReplyMaven