DevKits

Markdown Cleaner for LLMs — Strip Noise & Count Token Savings

Clean scraped Markdown or docs for LLM context: strip images, badges, HTML comments, excess blank lines, and link URLs (keeping the text). See exactly how many tokens you save. 100% local.

Last updated:

Comments

Paste Markdown (a scraped page, README, or docs) and this tool strips the noise that wastes context — images, badges, HTML comments, link URLs, and runs of blank lines — then shows the exact token count before and after using OpenAI's tokenizer. Everything runs in your browser.

Input Markdown… tokens
Cleaned output
… tokens
# Awesome Project

A tool for doing **awesome** things. See the documentation for details.

## Install

```bash
npm install awesome
```

Read more at our blog.

Cleaning runs entirely in your browser — nothing is uploaded.

What is Markdown Cleaner?

Markdown pulled from the web or a repo carries a lot of tokens that mean nothing to a language model: image and badge markup, HTML comments, decorative horizontal rules, long inline link URLs, and blocks of blank lines. Every one of those tokens is context you pay for and noise the model has to look past. This cleaner applies a set of toggleable transforms — remove images, strip shields/badges, drop HTML comments, unwrap links to just their text, and collapse blank lines — while leaving the actual prose, headings, lists, and code untouched. It then measures the result with the same o200k_base BPE tokenizer as the Token Counter, so the token saving you see is the real reduction in what a GPT model would be billed.

How to clean Markdown for an LLM

  1. 1Paste your Markdown.
  2. 2Toggle the cleanups you want (remove images, strip badges, unwrap links, collapse blanks…).
  3. 3Copy the cleaned output — the before/after token count shows your saving.

Key Concepts

Context window
The token budget for a request; cleaner input leaves more room.
Token saving
Measured with the real o200k_base tokenizer, matching GPT billing.
HTML to Markdown
Convert raw HTML to Markdown first, then clean it here.

Frequently Asked Questions

Why clean Markdown before sending it to an LLM?

Scraped pages and READMEs are full of tokens that add no meaning for the model — image markup, shields.io badges, HTML comments, long link URLs, and runs of blank lines. Stripping them shrinks the context you pay for and can improve the model's focus. This tool shows the before/after token count so you can quantify the saving.

Does it change the meaning of the text?

No — it removes markup and noise, not prose. Link text is kept while the URL is dropped (optional), images are removed, and headings/lists/code stay intact. You choose which cleanups to apply.

How is the token saving measured?

With OpenAI's real BPE tokenizer (o200k_base), the same one used by the Token Counter — so the savings shown match what you'd actually be billed for GPT models.

Try Next

Context Window Checker

Check whether your prompt fits a model's context window before you send it. Estimates prompt tokens, reserves room for the response, and shows remaining headroom across GPT-4o, o1, Claude, Gemini, DeepSeek and more. 100% local.

Related Tools

Reference & Guides