Formats
Converting HTML and web pages to Markdown with MarkItDown
Give MarkItDown an HTML file or a web address and it converts the whole page body to Markdown, menus and footer included. It fetches like a script, not like a browser: it runs no JavaScript and some sites refuse the request. We tested these cases on a local server we control, plus two real addresses.
Short answer
No extra is needed:
markitdown https://example.comClean structure from real HTML, no main-content extraction, no JavaScript. A page that refuses scripts fails with an HTTP error, as Wikipedia did for us.
Tested with markitdown 0.1.9 · Python 3.13 · markitdown 0.1.9 · a local test server for most cases, plus two real addresses from a cloud lab network (T20). One small test page, so size figures are illustrative · 2026-11-16 · evidence: web-sources.csv, static-article-local-server.md, article-main-only.md
What is kept, changed and dropped
Our test page has navigation, a cookie notice, an article with a table, nested list, code block, image and links, and a footer. This is what MarkItDown wrote:
[Home](https://example.org/) [News](https://example.org/news/) [About](https://example.org/about)
We use cookies. Accept
# Spring rainfall rose 12%
Three stations reported **steady** rain; see the [data](https://example.org/data/table.csv) and [the source](https://example.org/x).
## Key points
* Uptime reached 99.2%
+ nested item
* Two stations need batteries
| Station | Rain (mm) |
| --- | --- |
| Alpha | 412.5 |
| Bravo | 388.0 |
```
print("hello")
```

Text with an inline `code` span.
Copyright 2026 Example · Privacy · Terms · Contact usWe use cookies. Accept
Spring rainfall rose 12%
Three stations reported steady rain; see the data and the source.
Key points
- Uptime reached 99.2%
- nested item
- Two stations need batteries
| Station | Rain (mm) |
|---|---|
| Alpha | 412.5 |
| Bravo | 388.0 |
print("hello")
[image]
Text with an inline code span.
Copyright 2026 Example · Privacy · Terms · Contact us
- Kept: headings, bold, links, nested lists, a table with its header row, an image as
, inline code. - Changed: the code block's language class (
language-python) was dropped from the fence. - Dropped: the
<script>and<style>content. The navigation, cookie notice and footer text stayed.
There is no "main content" mode
On our small test page, 29% of the output (178 of 613 characters) was navigation, cookie text and footer. We measured only this one page, so real news pages will differ. Passing only the <main> element to MarkItDown removes it:
# Spring rainfall rose 12%
Three stations reported **steady** rain; see the [data](https://example.org/data/table.csv) and [the source](https://example.org/x).
## Key points
* Uptime reached 99.2%
+ nested item
* Two stations need batteries
Spring rainfall rose 12%
Three stations reported steady rain; see the data and the source.
Key points
- Uptime reached 99.2%
- nested item
- Two stations need batteries
You select the element yourself with an HTML parser, or use a readability-style extractor first; we did not test one. For language-model use, the boilerplate is often acceptable.
Converting a URL
| Case | Worked | Characters | Result |
|---|---|---|---|
| static article (local server) | yes | 613 | [Home](https://example.org/) [News](https://example.org/news/) [About](https://example.org |
| JavaScript-rendered shell | yes | 10 | Loading... |
| redirect to the article | yes | 613 | [Home](https://example.org/) [News](https://example.org/news/) [About](https://example.org |
| 404 page | no | 0 | HTTPError: 404 Client Error: Not Found for url: http://127.0.0.1:49149/missing |
| PDF served over HTTP | yes | 926 | Pilot Report: Field Station Alpha 1. Summary Rainfall across the three stations rose stea |
| RSS feed over HTTP | yes | 30 | # Rain feed ## Item one First |
| site that refuses python-requests (403) | no | 0 | HTTPError: 403 Client Error: Forbidden for url: http://127.0.0.1:49149/blocked |
| request headers the converter sends | yes | 104 | Accept header: text/markdown, text/html;q=0.9, text/plain;q=0.8, \*/\*;q=0.1 UA: python-r |
| Wikipedia article, desktop address | no | 0 | HTTPError: 403 Client Error: Forbidden for url: https://en.wikipedia.org/wiki/Markdown |
| Wikipedia article, mobile address | no | 0 | HTTPError: 403 Client Error: Forbidden for url: https://en.m.wikipedia.org/wiki/Markdown |
| example.com | yes | 156 | This domain is for use in documentation examples without needing permission. This is not a |
| blocked site, fetched with your own client then converted from the bytes | yes | 613 | [Home](https://example.org/) [News](https://example.org/news/) [About](https://example.org |
| blocked site, your own requests.Session passed to MarkItDown | yes | 613 | [Home](https://example.org/) [News](https://example.org/news/) [About](https://example.org |
| article page: whole page against only the <main> element | yes | 613 | main only: 435 characters; boilerplate share 29% |
What the table shows:
- A redirect was followed. A PDF served over HTTP converted as a PDF. An RSS feed converted to a title and items.
- A JavaScript-rendered page gave only its placeholder text (
Loading...): the script did not run. - A 404 raised
HTTPError, as did a 403. - The converter sends
Accept: text/markdown, text/html;q=0.9, text/plain;q=0.8, */*;q=0.1and the identity of therequestslibrary.
403 Forbidden
en.wikipedia.org and en.m.wikipedia.org both answered MarkItDown's request with 403 from our network. Sites refuse the default script identity for their own reasons, and we are not going to document ways around a site's access rules. Legitimate routes:
- Use the site's API where it has one (Wikipedia does).
- Fetch the page yourself with an HTTP client under conditions the site allows, then hand MarkItDown the bytes:
convert_stream(stream, file_extension=".html"). On our local server this converted the same page that the default request could not (613 characters). - Pass your own
requests.Session, with whatever headers you are allowed to send, toMarkItDown(requests_session=...). This worked in the same local test.
We did not test Wikipedia's dedicated converter, because we could not fetch the pages.
JavaScript-rendered pages
You get the page's initial HTML. Render the page in a browser you control, save the HTML, and convert that file. We did not test this procedure.
Not tested
Search-result pages, cookie-wall pages on real sites, pages in other encodings, very large pages, and the Wikipedia converter.