How to convert a web page to Markdown (for notes and LLMs)
Four ways to turn a web page into clean Markdown, from one click to thousands of URLs.
The hard part is not the HTML-to-Markdown conversion itself. It is throwing away menus, cookie banners, ads and footers so that only the article is left. Every method below handles that differently.
1. One page you are reading: a browser extension
MDGrab (ours, free) clips the page in your tab to Markdown with Mozilla Readability, the engine behind Firefox Reader View, so navigation and ads are dropped. Headings, links, images, tables and code blocks are kept, optional YAML front matter adds the title, URL, author and date for Obsidian, and you can select text first to clip only that part. It works on pages behind a login because it reads the page as you see it.
2. Online, without installing anything
Open the page, press Ctrl+U (view source) or use DevTools → right-click the article element → Copy → Copy outerHTML, and paste it into the free HTML to Markdown converter. It runs in your browser and turns tables into GitHub-flavored Markdown. Copying just the article element skips the clean-up.
3. Python or the command line: trafilatura
pip install trafilatura
trafilatura -u "https://en.wikipedia.org/wiki/Markdown" --markdown > markdown.md
trafilatura downloads the page, extracts the main text (tables included) and prints Markdown. In Python: trafilatura.extract(trafilatura.fetch_url(url), output_format="markdown"). Like every tool that downloads HTML itself, it sees what the server sends: pages that build their content with JavaScript, or need a login, come back empty or partial.
To control the conversion yourself (code-block languages, links, which part of the page), see markdownify vs html2text in Python.
4. Hundreds of URLs: a hosted extractor
For a list of URLs (a sitemap, a docs site, research sources for an LLM), a hosted scraper saves you from running and babysitting a script. Our Article Extractor on Apify returns Markdown, plain text, title, author and date per URL and is billed per result.
Tips for LLM prompts
- Markdown keeps headings and tables while using far fewer tokens than raw HTML.
- Keep the source URL at the top (front matter or a first line) so the model and you can cite it.
- Check long pages for truncation: some sites split an article over several elements or pages.
Frequently asked questions
What is the best web page to Markdown converter?
For one page you are reading, a browser extension (works behind logins). For scripts, trafilatura. For many URLs without running anything yourself, a hosted extractor.
Can I convert a page that needs a login?
Use a browser extension: it reads the page as shown in your logged-in tab. Server-side tools fetch the page without your session.
Does it keep tables and code?
MDGrab and the converter on this site keep tables as GitHub-flavored Markdown and code blocks with their language. trafilatura also outputs tables.
Is Markdown better than plain text for ChatGPT or Claude?
Usually yes: headings, lists, tables and links survive, which helps the model follow the structure, and it is much shorter than HTML.
Written with AI assistance. The trafilatura command and Python call were run against the page shown. MDGrab is our extension; the other methods are free.