Website to Markdown: Convert Any URL to .md
September 11, 2026 · 9 min read
Website to Markdown: Convert Any Web Page or URL to .md
Converting a website to Markdown takes three steps. Fetch the page's HTML, extract the article from the navigation and ads, and convert what's left. This tutorial shows the fastest route (paste a URL into our converter), then the scripts and APIs for batch jobs, plus the cleanup checklist every converted page needs.
What Happens When You Convert a URL to Markdown?
Every url to markdown tool runs the same pipeline, and knowing it explains why two tools give different output for the same page.
- Fetch. An HTTP request pulls the raw HTML. JavaScript-rendered pages return a near-empty shell here.
- Extract. A readability step keeps the block that looks like the article. Firefox's Reader View uses Mozilla's Readability library, and most converters use it or a port.
- Convert. An HTML-to-Markdown library emits
#forh1,**forstrong, and fences forpre. Turndown does this in JavaScript, markdownify in Python. - Clean. Relative links, missing alt text, and stray footer text get fixed by hand or by script.
Skip step 2 and your Markdown starts with the cookie banner. That single step separates a good converter from a bad one, and step 1 is why JavaScript-heavy pages come back blank.
Step 3 on its own is the subject of our HTML to Markdown guide, which covers Turndown and Pandoc options in detail. This post is about the whole chain, starting from a live URL.
How Can I Convert a Webpage to Markdown Without Code?
Paste the address into the URL to Markdown converter, press Enter, and the extracted article appears in the editor as Markdown. It keeps the title and headings, body paragraphs, links with their URLs, images as  references, lists, tables, and code blocks where the page has them. Edit the result in place, then copy or download the .md file.
Two limits are worth knowing before you paste. It only reaches public pages, so anything behind a login needs the HTML pasted into the HTML to Markdown tool instead. And pages that render entirely in JavaScript may come back thin, because the fetch step sees the empty shell.
For a page you're reading right now, a browser extension is quicker than switching tabs. Search the Chrome Web Store for "webpage to markdown" and pick one that shows the Markdown in a side panel. Most wrap Readability and Turndown, so the output matches the pipeline above.
Try Web to Markdown Output in the Editor
The snippet below is what a typical documentation page looks like after conversion, before any cleanup. Notice the relative link, the image with empty alt text, and the code block with no language tag, all of which the checklist further down fixes.
Paste your own converted page into the editor to check that headings kept their levels and that code blocks came through as fenced blocks rather than paragraphs.
URL to Markdown in Python
For batch jobs, 12 lines of Python cover the full pipeline. readability-lxml is a Python port of the same arc90 Readability algorithm and markdownify does the conversion.
pip install requests readability-lxml markdownify
import requests
from readability import Document
from markdownify import markdownify as md
url = "https://example.com/blog/some-article"
html = requests.get(url, headers={"User-Agent": "md-fetch/1.0"}, timeout=20).text
doc = Document(html)
body = md(doc.summary(), heading_style="ATX", bullets="-")
with open("article.md", "w") as f:
f.write(f"# {doc.title()}\n\n{body}")
heading_style="ATX" gives you ## headings instead of underlined ones, and bullets="-" keeps list markers consistent. markdownify also ships a command-line tool, so markdownify page.html > page.md works when you already have the HTML on disk.
Prefer html2text? It's older and its output is wrapped at 78 characters by default, which most people turn off with h.body_width = 0. We prefer markdownify for new scripts because its defaults produce cleaner GFM.
URL to Markdown API and Node Options
If you'd rather call a service than run a script, a few are worth knowing.
Jina Reader is the simplest url to markdown api: prefix any address with https://r.jina.ai/ and fetch it.
curl https://r.jina.ai/https://example.com
The response is plain text with a short header (Title:, URL Source:, Markdown Content:) followed by the Markdown. As of the current docs it allows 20 requests per minute without a key and 500 with a free one.
Firecrawl exposes POST /v2/scrape on api.firecrawl.dev with a formats array that can include markdown. It needs an API key and handles JavaScript rendering, which the plain fetch approaches above don't.
For JavaScript-heavy pages without a paid service, drive a headless browser yourself. Playwright's page.content() returns the rendered DOM, which you then hand to Readability and Turndown exactly as in the Node example below. It's slower per page, so reserve it for the sites that need it.
Pandoc can read a URL directly, no script required, per the Pandoc manual:
pandoc -f html -t gfm https://example.com -o page.md
It skips the extraction step, so expect the navigation and footer in the output.
Node, for when the rest of your stack is JavaScript. This is the same Readability plus Turndown combination most online converters run:
npm install jsdom @mozilla/readability turndown turndown-plugin-gfm
import { JSDOM } from "jsdom";
import { Readability } from "@mozilla/readability";
import TurndownService from "turndown";
import { gfm } from "turndown-plugin-gfm";
const url = process.argv[2];
const html = await (await fetch(url)).text();
const article = new Readability(new JSDOM(html, { url }).window.document).parse();
const td = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
td.use(gfm);
console.log(`# ${article.title}\n\n${td.turndown(article.content)}`);
Passing url to JSDOM makes relative links absolute, which saves a cleanup step. Turndown defaults to setext headings and indented code, so the two options in the constructor matter. The gfm plugin adds tables and strikethrough, which Turndown leaves out on its own.
The Cleanup Checklist for Converted Pages
Run through these on every file before you file it away. In our experience the first three catch most of the problems.
- Residual chrome. "Edit this page", "Previous / Next", and cookie notices slip past extraction. Delete them.
- Relative links.
[docs](/docs/config)points nowhere once the file leaves the site. Prefix the domain, or pass the base URL to your parser. - Empty alt text.
is common because the source had none. Describe the image or drop it. - Code blocks without a language. Converters rarely recover the highlighter class. Add it after the opening fence.
Three more show up less often but cost more time when they do.
- Flattened tables. Without the GFM plugin, a table becomes run-on paragraphs. Reconvert with tables enabled.
- Heading levels. Pages that start at
h2for styling reasons produce Markdown with no H1. Promote the levels. - Hard-wrapped lines. Some tools wrap at 78 characters. Turn wrapping off in the tool rather than unwrapping by hand.
Two things no checklist fixes. Content behind a paywall or login can't be fetched by any of these tools, and a site's terms of use still apply to what you convert. Check robots.txt before batch-crawling someone else's documentation.
Why Convert a Website to Markdown at All?
Three groups do this constantly. Note-takers archive articles into Obsidian or Logseq, where Markdown is the native format and a converted page becomes a searchable, linkable note. Documentation teams migrate content between platforms and want the structure without the old site's HTML. And people building with language models feed pages to the model as Markdown because it carries headings and lists in far fewer tokens than HTML.
That last case has grown fastest. A model reads ## Installation and a bullet list more reliably than the same content wrapped in div and span tags, and the token savings add up over a large context. Our Markdown in AI explainer covers why chat models write Markdown by default, and the Markdown vs HTML comparison answers whether Markdown is the better format for your own site.
Source PDFs need a different pipeline entirely; see PDF to Markdown for that.
Website to Markdown FAQ
Turning a website to Markdown is a fetch, an extraction, and a conversion, and the quality of the result depends almost entirely on the extraction step. Use the URL converter for single pages, the Python or Node script for batches, and the checklist for everything. Then open the result in the editor to confirm the structure survived.
