Text Cleaner
Stack cleanup steps in the order you need and see what each one changed. A hidden-character scan explains why "duplicates" survive, and your recipes are saved for next time.
Your text stays in this tab and is never saved. Your steps are saved in this browser so they are ready next time.
🔎 Hidden characters in your text
- 1 no-break space Looks like a space but is a different character (U+00A0), so two lines that look the same are not equal.
- 2 lines ending in spaces Spaces at the end of a line are the most common reason duplicates survive.
- 1 line starting with spaces Indentation or stray spaces at the start of a line.
📚 Start from a recipe
A recipe replaces your current steps. You can change every step afterwards.
🧹 Steps, run from top to bottom
- 1 line changed
Turns no-break and other Unicode spaces into normal spaces and deletes zero-width characters, soft hyphens, byte order marks and control codes. · 12 → 12 lines
- 3 lines changed
Removes spaces, tabs and no-break spaces from the ends of every line. · 12 → 12 lines
- 2 lines removed
Deletes lines with nothing on them. · 12 → 10 lines
- 2 duplicates removed
Keeps one copy of each line, in the original order. · 10 → 8 lines
Most repeated:
banana×3 - 3 lines moved
Reorders the lines. Equal lines keep their original order. · 8 → 8 lines
➕ Add a step
✅ Result
12 lines · 85 characters → 8 lines · 63 characters
apple↔Applecherry↔Cherrydate palm↔Date palm
💾 Your recipes
Recipes you save appear here. They stay in this browser and nowhere else.
The link carries your step settings, including any find & replace text, but never your input text.
Free to use. Results are estimates for general information, not professional advice — see our full disclaimer.
Most text cleaners give you a row of checkboxes that run in a fixed order you cannot see, or a separate page for each job. This one is a pipeline. You stack steps in the order you choose: trim, remove duplicates, sort, find and replace, join, split and eleven more. Every step shows what it did: how many lines went in and came out, how many duplicates it removed, how many matches it replaced. You can turn a step off to see its effect or move it up and down, and the result updates as you type.
It also explains why cleanup sometimes fails. A hidden-character scan counts the no-break spaces, zero-width spaces, byte order marks and curly quotes that make two identical-looking lines unequal. After the last step, a duplicate check lists lines that still match another line once case and spacing are ignored, and one click fixes them. Change case uses the Case Converter rules, and Fancy letters → plain uses the Fancy Text Generator decoder. Save your steps as a recipe, or copy a link that carries the steps but not your text.
How to use the text cleaner
- Paste your text, such as a list, a spreadsheet column or a paragraph from a PDF. The scan underneath flags hidden characters straight away.
- Pick a recipe or add steps. A recipe such as Clean a list loads a ready-made set of steps. The buttons under the step list add single steps.
- Arrange and adjust. Move steps with ↑ and ↓, untick a step to skip it, and change its options. Each card shows its count, for example 2 duplicates removed · 10 → 8 lines.
- Check the result. Show hidden characters marks no-break spaces (⍽), tabs (⇥), zero-width characters (¦) and trailing spaces (·).
- Copy, download or reuse. Copy the result, save it as a .txt file, or press Use as input for another pass. Name and save the steps to reuse them.
How the pipeline works
The tool treats your text as a list of lines. Windows line endings (CRLF) become plain line breaks first. A single line break at the very end is ignored, so it does not count as an empty line. Each step takes the lines from the step above and passes its output to the step below. A step that is switched off passes the text through unchanged.
| Step | What it does | Count |
|---|---|---|
| Trim, Collapse spaces | Strip spaces from line ends, or squeeze runs of spaces | Lines changed |
| Fix hidden characters | Unicode spaces → normal spaces; deletes zero-width characters, soft hyphens, BOMs; optional straight quotes | Lines changed |
| Fancy letters → plain | 𝐁𝐨𝐥𝐝, script, bubble and full-width letters → plain; fi → fi | Characters converted |
| Remove or squeeze empty lines | Deletes blank lines, or keeps one between paragraphs | Lines removed |
| Remove duplicates | First copy, last copy or only lines that appear once | Duplicates removed |
| Sort lines | A→Z, natural, case-sensitive, length, reverse, shuffle | Lines moved |
| Keep or remove lines | Lines containing a word or matching a regex | Lines removed |
| Find & replace | Plain text or regex over the whole text | Matches replaced |
| Change case, Prefix / suffix, Number lines | Edits each line | Lines changed |
| Join, Split, Unwrap, Wrap | Changes where lines break | Lines joined, split or wrapped |
The A→Z sort uses Unicode collation, so apple and Apple sit together and Korean sorts in 가나다 order. The case-sensitive sort compares code points, the same order as LC_ALL=C sort, and natural order (file2 before file10) matches GNU sort -V. Equal lines keep their original order, and a shuffle stays put until you press Shuffle again.
Find & replace runs over the whole text with the g and m flags. That means ^ and $ match at every line, and a pattern can match across a line break with \n. In plain mode, both the search text and any $ in the replacement are taken literally. In regular expression mode, the replacement understands $1 and $&. In both modes you can type \n for a line break and \t for a tab.
Why the order of steps matters
Each step sees only what the step above left behind, so the same steps in a different order can give different results.
- Trim before removing duplicates. Given
apple,apple(trailing space) andbanana, removing duplicates first keeps both apples. Trim first and the second apple goes. - Fix hidden characters before you compare. A no-break space looks exactly like a space, so this step belongs near the top.
- Escape before you wrap. For a SQL list, doubling apostrophes (
'→'') has to happen before each value is wrapped in quotes. If it runs afterwards, it doubles the wrapping quotes as well. - Filter before you join. After a join there is only one line left, so line-based steps after it see a single line.
Worked examples
A messy list. The sample has 12 lines, including three copies of banana, apple with a trailing space, an indented cherry, a no-break space inside date palm and two blank lines. With Clean a list, Fix hidden characters changes 1 line, Trim changes 3, Remove empty lines removes 2, Remove duplicates removes 2 and Sort moves 3, leaving 8 lines. The duplicate check then flags three pairs that differ only in case, such as apple and Apple. Press the fix button and 5 lines remain.
An email export. These four lines mix commas, semicolons, a stray leading space and capitals:
Ana@Example.com, bob@example.com
carol@example.com; ana@example.com
BOB@example.com
dave@example.com
The Email list → comma list recipe splits these into six addresses, then lowercases, removes duplicates, sorts and joins them, leaving four: ana@example.com, bob@example.com, carol@example.com, dave@example.com. Mainstream providers ignore case in addresses, but turn off Change case if your system does not.
A paragraph copied from a PDF.
The first results were promis-
ing, but the sample was
small.
Unwrap PDF text turns the fi ligature into fi, joins the three lines and rejoins promis-ing, giving The first results were promising, but the sample was small. Turn off the hyphen option if your text has real hyphenated words at line ends, such as well-known, because it would become wellknown.
A SQL IN list. The lines O'Brien, Smith, Nguyen and Smith become IN ('O''Brien', 'Smith', 'Nguyen') with the SQL IN (…) list recipe.
Hidden characters that break cleanup
| Character | Code point | Where it usually comes from |
|---|---|---|
| No-break space | U+00A0 | Web pages, spreadsheet exports, Word, Option+Space on a Mac |
| Narrow no-break space | U+202F | French typography, and the space before AM or PM in times formatted by recent browsers |
| Zero-width space | U+200B | Web editors, chat apps and copied links |
| Soft hyphen | U+00AD | Hyphenation hints in web text and ebooks |
| Byte order mark | U+FEFF | The start of UTF-8 files saved by some Windows programs and CSV exports |
| Curly quotes | U+2018, U+2019, U+201C, U+201D | Word, Google Docs and phone keyboards |
The code points come from the Unicode Standard’s character database. Fix hidden characters deliberately leaves the zero-width joiner (U+200D) and non-joiner (U+200C) alone, because emoji such as 👨👩👧 and scripts such as Persian and Hindi need them.
Tips
- Put Fix hidden characters and Trim spaces at the top of any recipe that compares lines.
- To remove duplicates while keeping the first spelling of each item, turn on Ignore case in Remove duplicates instead of lowercasing everything.
- To find values that appear in only one of two lists, paste both lists together and choose Only lines that appear once.
- To compare the text before and after cleaning, paste both into the Text Diff tool.
- A regular expression with nested repeats, such as
(a+)+, can freeze the tab on long lines, so keep patterns simple.
Privacy
Your text is processed in this tab and never sent to a server. The text box is not saved, so reloading starts fresh. Your steps and saved recipes stay in your browser’s local storage. A shared link holds only the step settings, including any find and replace text, but never your text.
Frequently asked questions
Why are some duplicate lines not removed?
Because they are not identical. The usual causes are a trailing space, a no-break space (U+00A0) pasted from a web page or spreadsheet, a zero-width space, or different capitals. The result panel lists lines that differ only in these ways, and one click makes duplicate removal ignore case and spacing.
Does the order of the steps matter?
Yes. Steps run from top to bottom, and each one works on the output of the step above. Trimming before removing duplicates treats "apple " and "apple" as the same line, while trimming afterwards keeps both. Escaping apostrophes before you wrap values in quotes gives O''Brien. Doing it afterwards doubles the wrapping quotes too.
How do I remove duplicate lines but keep the original order?
Add Remove duplicates and leave out any sort step. It keeps the first copy of each line where it first appeared, like the Unix one-liner awk '!seen[$0]++'. Choose Last copy to keep the final copy instead, or Only lines that appear once to drop every line that repeats.
Can I use regular expressions?
Yes, in Find and replace, Keep or remove lines, and Split into lines. They use JavaScript syntax. Find and replace runs with the g and m flags, so it replaces every match, and ^ and $ match at the start and end of each line. In the replacement, $1 inserts the first captured group.
Is my text uploaded or saved?
No. Every step runs in your browser tab, and the text box is not stored, so closing the tab discards your text. Only your step settings are saved in this browser's local storage, so the same steps are ready next time. A shared recipe link contains the step settings but never your text.
How do I turn a column of values into a comma-separated list?
Paste the column, then add Join lines with a comma and a space as the separator. If each value needs quotes, add a prefix and suffix step before the join. The SQL IN list recipe does both. It also escapes apostrophes first and wraps the result in IN ( ).
Related tools
- Case ConverterPaste text once and get every capitalisation style at the same time — sentence, title, camel, snake, kebab and a few playful ones — each with its own copy button.
- Text DiffPaste two versions of anything — a paragraph, a config file, a contract clause — and see exactly what changed, line by line and word by word, without uploading a thing.
- Fancy Text GeneratorType once and copy 32 Unicode styles, each with its real cost on X, the letters it cannot make and what a screen reader may say. Style only a few words of a post, or turn fancy text back into plain letters.
- Word CounterPaste or type your text and watch the counts update instantly — words, characters, reading time, keyword density and a readability score, all computed in your browser.
- Lorem Ipsum GeneratorMake as much placeholder text as your mockup needs — in classic Latin or three alternative flavours — with optional HTML tags and a seed that reproduces the exact same text every time.
- Word Search GeneratorType a word list and get a printable puzzle, an answer key with row and column for every word, and a link that opens the identical grid for solving on a phone or laptop.
Last reviewed: