A esm-native library that converts HTML to Markdown & Useful Utilities with simple, lightweight and epic quality.
npm i webforai
# or just run
npx webforai@latestThree ways to use it
The same extraction engine, wherever you want to run it.
npm i webforaiConvert HTML you already have — in Node.js, browsers, Deno or Cloudflare Workers. Free, local, no limits.
npx webforai <url>One command from URL or HTML file to Markdown on stdout. Built for pipes, scripts and AI agents.
POST /v1/scrapeWe run the browsers, proxies and queues: scrape, batch and crawl over HTTP. 500 free credits every month.
Try it
Paste a URL and get the Markdown webforai produces — converted live by the hosted webforai platform.
auto engine. No API key required — for more, create a free platform account (500 credits / month).Overview
import { htmlToMarkdown, htmlToMdast } from "webforai";
import { loadHtml } from "webforai/loaders/playwright";
// Load html from url
const url = "https://www.npmjs.com/package/webforai";
const html = await loadHtml(url);
// Convert html to markdown
const markdown = htmlToMarkdown(html, { baseUrl: url }); Features
- High-quality HTML to Markdown conversion with simple, customizable options
- ESM-native, compatible with various environments (browser, Cloudflare Worker, Node.js, etc.)
- Lightweight (only 146kb minified and gzipped)
- Flexibility because it's built on Syntax Tree ecosystem.
- MathML to LaTeX with mathml-to-latext package.
- Out-of-the-box loaders such as fetch, playwright, puppeteer.
- CLI tool
npx webforai <url>— Markdown on stdout,--jsonfor scripts and AI agents
Hosted platform
Don't want to run the browsers, proxies and queues yourself? webforai platform is an OSS, self-hostable
crawl→Markdown API built on this library — scrape, batch and crawl over four engines
(fetch / browser / proxy-fetch / proxy-browser, 1 / 5 / 2 / 5 credits per page) with an
auto default that escalates to browser rendering only when a page needs JavaScript, and
500 credits per month free. Use it over HTTP, through the typed
webforai/platform client, or straight from the CLI.


