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:
CommentsPaste 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.
# 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
- 1Paste your Markdown.
- 2Toggle the cleanups you want (remove images, strip badges, unwrap links, collapse blanks…).
- 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
Prompt Injection Detector
Scan untrusted user input for common prompt-injection and jailbreak patterns — instruction overrides, jailbreak personas, system-prompt exfiltration — with a risk score. Heuristic, 100% local.
Text Chunker
Split long text into overlapping chunks for embedding and RAG pipelines. Preview recursive, paragraph, sentence, or fixed strategies with live token counts. Runs 100% in your browser.
Cosine Similarity
Compute cosine similarity, dot product, and Euclidean distance between two vectors online. Perfect for debugging LLM embeddings, semantic search, and RAG pipelines. 100% local — vectors never leave your browser.
AI Cost Calculator
Estimate monthly LLM API cost across GPT-4o, Claude 3.5, Gemini, DeepSeek and 100+ models. Compare providers side-by-side with prompt-caching and batch discounts. Free, no signup — prices refreshed daily from the public LiteLLM catalog.
Token Counter
Count tokens in your prompt for GPT-4, GPT-3.5, Claude, and Gemini and predict API cost before you spend. Free, no signup — all counting runs locally, your prompt stays in your browser.
LLM JSON Extractor
Extract every JSON object or array buried inside an LLM reply — even when it's wrapped in markdown fences, mixed with explanation text, or has trailing commas and single quotes. Auto-repairs each block. 100% local.