Strip markup, de-duplicate, redact PII and normalize text for training, RAG and fine-tuning datasets — nothing leaves your browser.
100% client-side Handles very large text PII & secret redaction Public JS API included
One-click modes
1. Input text
Format: — Language: —
2. Choose cleaning operations
Format & markup
OCR & broken text
Unicode & whitespace
Duplicates
PII & sensitive data
Text filtering
3. Custom find & replace (applied in order, after built-in cleaning)
4. Custom regex cleaning
5. Run
6. Before vs after preview
Original
Cleaned
7. Statistics — before vs after
8. AI token estimate (approximate)
9. Readability & dataset quality
10. Cleaning summary report
11. Export
Upload files
📂
Drag & drop files
TXT, HTML, Markdown, JSON — processed with the settings from the Clean Text tab
.txt · .html · .htm · .md · .json
Files
No files added yet.
Save current configuration
Saved profiles
No saved profiles yet. Profiles are stored in this browser only.
Compare two configurations
Set the current checkbox selection as Config A or B, then compare their effect on the current input text.
Browser-based JS API
Since everything runs client-side, this page exposes a small JS API on window.CleanTextAPI for scripting from the browser console or another script tag on this page.
// Clean text programmatically (all options default to false unless set)
CleanTextAPI.clean("Hello world!! Visit http://example.com", {
op_urls: true,
op_dup_spaces: true,
op_trim: true
});
// -> { cleaned: "Hello world!!", report: [...], stats: {...} }
// List every available operation id
CleanTextAPI.listOperations();
// Apply a built-in preset by key
CleanTextAPI.cleanWithPreset("llm_training", rawText);
Keyboard shortcuts
Ctrl + Enter
Run cleaning
Ctrl + Shift + C
Copy cleaned output
Ctrl + Z
Undo last clean
Ctrl + Y / Ctrl+Shift+Z
Redo
Shared link
When you use "Copy shareable link" on the Clean Text tab, the cleaned output is base64-encoded into the URL fragment so it can be reopened without re-uploading anything. Very long outputs may exceed browser URL limits.
Why Cleaning Text Matters for LLM Training
Large language models learn patterns directly from the text they're shown, which means noisy input produces noisy output. Raw text pulled from web scrapes, PDFs, OCR scans, or chat exports is full of problems a model shouldn't learn from: leftover HTML tags, duplicated paragraphs, broken words from line-wrapped scans, stray emails and phone numbers, and inconsistent whitespace or Unicode characters. Left uncleaned, this noise wastes training tokens, skews the model toward repeating boilerplate, and can leak personal information into a fine-tuned model's outputs.
Cleaning text is the process of stripping that noise while preserving the meaning of the content — removing markup and navigation clutter, normalizing whitespace and punctuation, de-duplicating repeated lines or paragraphs, and optionally redacting PII before the text ever reaches a training pipeline, a RAG index, or a fine-tuning job.
Worked Example: Cleaning a Scraped Blog Page
Say you scraped the following snippet from a company blog:
Running this through a cleaning pipeline with Remove HTML Tags, Remove Boilerplate, Remove AI Response Phrases, Remove URLs, Remove Email Addresses, Remove Duplicate Lines, and Whitespace Normalization turns it into:
Welcome to Our Blog!!!
Here's info about cats.
Notice what happened: the navigation bar and copyright line were dropped as boilerplate, the canned AI disclaimer was stripped, the repeated URL/email line was removed as a duplicate, and the double space before "info" was normalized — all in one pass, with a report showing exactly what was removed and how many times.
Best Practices for Preparing LLM Training Data
Match cleaning intensity to the use case. A RAG dataset should keep sentence structure and context intact; a fine-tuning dataset can usually tolerate more aggressive stripping of formatting and filler.
Redact PII before de-duplication, not after. Removing emails, phone numbers, and API keys first prevents near-duplicate detection from being thrown off by tokens that differ only in the redacted portion.
Keep a before/after diff. Spot-checking a word-level diff catches over-aggressive rules (like a boilerplate filter that eats real content) before they corrupt an entire dataset.
Normalize Unicode and whitespace early. Curly quotes, non-breaking spaces, and inconsistent line endings silently break exact-match deduplication if they're not normalized first.
Process files in batch with one consistent configuration. Save a profile once you're happy with a rule set, and re-apply it identically across every file in the dataset.
Track a quality score, not just size reduction. A dataset can shrink a lot and still be low quality if what's left is mostly fragments or repeated boilerplate.
Common Mistakes to Avoid
Removing stop words for generative training. Stop-word removal is useful for some classic NLP/search tasks, but it destroys grammar and fluency — don't use it when preparing text a generative model will learn to write.
Deduplicating before checking scope. Removing "duplicate" sentences across an entire corpus can delete legitimate repeated phrases (like recurring product names); paragraph- or document-level dedup is usually safer than global sentence-level dedup.
Skipping PII redaction on "internal" data. Internal chat logs and support tickets often contain more personal data than public web text — don't assume a private source is automatically safe to train on unredacted.
Applying regex rules that are too greedy. A phone-number or date pattern written too loosely can silently eat valid numeric content like product codes or measurements — always check the operation counts in the report.
Ignoring encoding issues. Mojibake from mismatched character encodings (e.g., "’" instead of an apostrophe) won't be fixed by whitespace cleanup alone and needs Unicode normalization specifically.
Not versioning your cleaning config. If two contributors clean the same source with different settings, the dataset becomes inconsistent — save and share a profile instead of re-configuring by memory.
Frequently Asked Questions
What's the difference between cleaning for LLM training vs. cleaning for RAG?
Training data cleanup is usually more aggressive — the goal is a compact, high-signal corpus, so heavier deduplication and boilerplate removal are fine. RAG cleanup is lighter-touch, because retrieval quality depends on preserving natural sentence structure and context around the passages a retriever will later return.
Will cleaning text remove important information by accident?
It can, if rules are too broad. Aggressive regex-based PII removal or boilerplate filters occasionally match legitimate content. Always review the diff preview and operation counts, and test rules on a sample before applying them to a full dataset.
Should I remove duplicate lines, sentences, or whole paragraphs?
It depends on the source. Scraped web pages often have duplicate navigation lines (good candidate for line-level dedup). Long-form articles are better handled at the paragraph level, since sentence-level dedup can strip legitimate repeated phrasing used for emphasis or in dialogue.
Does removing PII guarantee the dataset is anonymized?
No. Pattern-based redaction catches common formats (emails, phone numbers, IPs, card numbers, keys), but it can't catch every way personal information appears in free text, such as a name and address described in prose. Treat it as risk reduction, not a compliance guarantee, and add manual review for sensitive sources.
How do I know if my cleaned dataset is good enough to train on?
Look at more than file size. A useful dataset has reasonable sentence length, low special-character density, low duplicate content, and readability appropriate to the task. A quality/readability score alongside a manual spot-check of a random sample is a good sanity check before a full training run.
What's the best way to clean OCR'd or scanned text?
OCR output typically needs ligature fixes (like "fi" → "fi"), rejoining of hyphen-broken words split across line wraps, removal of stray page numbers, and heavier whitespace normalization than born-digital text — general HTML/markup cleanup rules won't touch these issues.
Can I clean multiple files with the same settings automatically?
Yes — configure your cleaning rules once, save them as a profile, and apply that exact configuration across a batch of uploaded files so every document in the dataset is processed consistently.
Is it safe to clean sensitive text in a browser-based tool?
It depends on how the tool is built. A tool that processes text entirely client-side (no file upload to a server) keeps sensitive content on your device throughout redaction and cleanup, which is meaningfully safer than uploading raw sensitive text to a third-party API first.