Español

Lee este artículo en español.

Website to Markdown: 6 Ways to Convert a Web Page to Markdown (with Code)

Short answer: For one page right now, put https://r.jina.ai/ in front of the URL (Jina Reader). In your own code, use Readability with Turndown (Node.js) or markdownify (Python). Inside n8n or Zapier, use their built-in tools. For pages that need JavaScript, or when you want only the main content and the metadata in one call, use the Cofferdock URL to Markdown API.

Markdown is plain text with a few simple marks: # for titles, - for lists and text for links. AI models read it well, and it is easy to save, search and version. A raw web page is full of tags, scripts and menus. Markdown keeps headings, lists, links and tables with much less noise.

Quick comparison

WayBest for
Jina ReaderOne page, no code, free
Python with markdownifyScripts that convert the whole page
Node.js with Readability and TurndownYour own code, keeping only the article
n8nAutomations with the built-in nodes
Zapier and MakeNo-code flows (Make gives plain text)
Cofferdock APIJavaScript pages, main content and metadata

1. Jina Reader

Put https://r.jina.ai/ in front of the page address and run this in a terminal:

curl "https://r.jina.ai/https://example.com/article"

It returns the page as text that is easy for AI to read. It is free for basic use without a key, at 20 requests per minute, and a key allows more. If you need one page today, this is the fastest option.

2. Python with markdownify

Install the two libraries with pip install requests markdownify, then run this script:

import requests
from markdownify import markdownify as md

html = requests.get("https://example.com/article", timeout=20).text
print(md(html, heading_style="ATX"))

This converts the whole page, menus included. requests does not run JavaScript, so pages that build their content with JavaScript come back almost empty.

3. Node.js with Readability and Turndown

Readability keeps only the main content of the page, the same idea as Firefox's reader view. Turndown converts that HTML to Markdown. Install them with npm install jsdom @mozilla/readability turndown, save the code below as article.mjs and run it with node article.mjs:

import { JSDOM } from 'jsdom';
import { Readability } from '@mozilla/readability';
import TurndownService from 'turndown';

const url = 'https://example.com/article';
const html = await (await fetch(url)).text();
const dom = new JSDOM(html, { url });
const article = new Readability(dom.window.document).parse();
const markdown = new TurndownService({ headingStyle: 'atx' }).turndown(article.content);
console.log(article.title);
console.log(markdown);

Like the Python version, fetch does not run JavaScript. It is a good choice when you want clean article text and you control the code.

4. Inside n8n

n8n has the tools you need without any extra service:

  1. Add an HTTP Request node. Set the method to GET and the URL to the page. Under Options → Response → Response Format, choose Text. The HTML arrives in the field data.
  2. Add a Markdown node after it. Set the mode to HTML to Markdown, and set HTML to {{ $json.data }}. Choose a name for Destination Key, which is the output field.
  3. Under Options, set Ignored Elements to nav, footer to drop menus and footers.

Remember that the HTTP Request node does not run JavaScript. For a full walkthrough, see the step-by-step guide.

5. Inside Zapier and Make

Zapier: use Web Parser by Zapier, with the event Parse Webpage. Set URL to parse to the page, and Content type to Markdown. The parser is built for articles, so it may not suit every layout. There is also a Formatter step, Formatter by Zapier → Text → Convert HTML to Markdown, but some users report extra line breaks in its output. For plain text only, use Remove HTML Tags. See the Zapier guide.

Make: use the HTTP → Make a request module with GET to get the HTML. Then Text parser → HTML to text gives you formatted plain text, not Markdown. The built-in function stripHTML() also gives plain text, for example {{stripHTML(1.data)}}. See the Make guide.

6. The Cofferdock URL to Markdown API

This tool opens the page in a real browser (Chromium) with JavaScript on, so it also reads sites that build their content with JavaScript. By default it keeps only the main content, with the same detection as Firefox's reader view. It also returns the page metadata: title, description, image, language, author, site name and dates.

You can also send HTML you already have with html instead of url, and use base_url to make relative links absolute. The main options are format (markdown, text or metadata), main_content, include_links, include_images, max_chars and wait_ms.

Here is a call for one article:

curl -X POST "https://api.cofferdock.com/web-to-markdown" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/article"}'

A successful answer looks like this:

{ "success": true, "title": "...", "content": "## First step\n\nArticle text...", "length": 4821, "truncated": false, "meta": { "main_content_found": true } }

Each page costs 1 credit, and failed calls are not charged. The limits are one page per call, up to 4 MB of HTML and 20 requests per minute per IP. The free plan includes 50 credits a month, with no card. If the free ways above are enough for you, use them. The API is worth it when pages need JavaScript, when you want the metadata, or when you do not want to maintain the code yourself.

Common problems

FAQ

What's the easiest way to convert a web page to Markdown? For one page, use Jina Reader: put https://r.jina.ai/ in front of the address. You need no code.

Which tools keep only the main content? Tools based on Readability do: our API, and Readability in your own Node.js code. markdownify converts everything on the page.

Can I convert HTML I already have? Yes. You can use markdownify in Python, Turndown in Node.js, the Markdown node in n8n, the Formatter by Zapier, or our API with the html input.

Is there a free option? Yes. Jina Reader works without a key, the libraries are free, and n8n and Zapier have built-in tools. Our free plan has 50 credits a month, with no card.

Related guides

Try it yourself

Try the tool at cofferdock.com/web-to-markdown. You can create a free account at cofferdock.com/register, with 50 credits a month and no card.