HTMLโ†’Markdown

Clean HTML for AI Training Data

Building a fine-tuning dataset or training corpus from web content? The biggest challenge isn't getting the HTML โ€” it's cleaning it. Every web page comes wrapped in navigation, ads, cookie dialogs, related-article widgets, and layout markup that pollutes your training data.

This tool applies a density-based content extraction algorithm (the same approach used by academic boilerplate removal research) to automatically identify and extract the primary content from each page. The result is clean, structured Markdown that represents what a human would consider "the article."

Why Clean Data Matters for AI Training

The Density Extraction Algorithm

The converter scores each container element (<div>, <section>,<article>, <main>) by computing a signal score based on:

The highest-scoring container is selected as the content block. Everything else โ€” nav, footer, sidebar, ads โ€” is discarded before Markdown conversion.

How It Works

  1. Collect your HTML โ€” Crawl, scrape, or export the pages you want in your training set
  2. Batch convert โ€” ZIP up to 200 HTML files and upload them (up to 100 MB per archive)
  3. Download clean Markdown โ€” Each file is processed independently, so one bad page doesn't block the rest
  4. Use in your pipeline โ€” Feed the .md files into your tokenizer, chunker, or fine-tuning script

Compared to Other Approaches

ApproachProsCons
Regex strippingFastBrittle, site-specific, misses semantic structure
BeautifulSoup + heuristicsFlexibleRequires per-site tuning, slow on large batches
Readability.jsGood for articlesDesigned for single pages, not batch processing
This tool (density extraction)Works on any site without tuning, batch processing, GFM outputMay not handle very unusual layouts

Best Practices for Training Data

Privacy

Processing happens entirely in your browser via WebAssembly. Your training data is never uploaded to any server. This is especially important when working with proprietary content, licensed datasets, or data subject to agreements.

Related