Fix Messy Text: Case, Spaces and Duplicate Lines
October 12, 2026
3 readsText that arrives from somewhere else is rarely clean. It's in ALL CAPS, or has double spaces, stray blank lines, repeated entries or a title in the wrong style. Fixing it by hand is slow and error-prone. The good news is that most of these problems follow patterns that a simple tool can fix in a second, as long as you know what each one actually does and what it can't.
Fixing case
Case problems are the most visible. Our Case Converter offers nine options:
- UPPERCASE and lowercase: change every letter.
- Title Case: capitalizes the first letter of every word.
- Sentence case: capitalizes the first letter of the text and lowercases the rest.
- camelCase, PascalCase, snake_case, kebab-case and CONSTANT_CASE: the naming styles used in programming, URLs and configuration.
What to check afterwards
Automatic conversion is fast but literal, so a few things need a manual look:
- Title Case capitalizes every word, including small ones. Style guides usually keep short words such as "a", "of", "and" and "the" lowercase unless they start the title. If you follow such a guide, lowercase those by hand.
- Sentence case lowercases everything after the first letter. That includes proper nouns, acronyms and the pronoun "I", so "NASA launched the rocket in Florida" becomes "Nasa launched the rocket in florida". Restore names and acronyms afterwards.
- For a long text, sentence case only capitalizes the very first letter, not the start of every sentence. Fix the later sentences by hand.
- Programming cases remove spaces (and snake_case, kebab-case and CONSTANT_CASE also drop other special characters), so check that the result is still readable.
When the case was the only problem, the tool does 95% of the work and you fix the exceptions.
Removing extra spaces
Pasted text, especially from PDFs and old documents, often contains double spaces, tabs and gaps at the ends of lines. Remove Extra Spaces collapses runs of spaces and tabs into one space, trims the start and end of each line, and removes empty lines. It leaves single line breaks between lines, so paragraphs stay as separate lines.
Because it removes blank lines, it will squash the gaps between paragraphs. If you need those gaps, add them back afterwards or use the tool on one paragraph at a time.
Removing duplicate lines
Lists collect duplicates: email addresses from several sources, keyword lists, product names, log entries. Remove Duplicate Lines keeps the first occurrence of each line and removes later repeats, preserving the original order, and tells you how many it removed.
What counts as a duplicate matters:
- Matching is exact. "Apple" and "apple" are different lines, as are "apple" and "apple " with a trailing space.
- To catch near-duplicates, normalize first: remove extra spaces, then convert to lowercase, then remove duplicates.
That order is a reliable recipe for cleaning a list: spaces, then case, then duplicates.
Sorting lines
Once a list is clean, Alphabetical Sort puts it in order, ascending or descending, with an option for case sensitivity. Sorting a list is also a good way to see problems: near-duplicates and typos end up next to each other.
Remember that text sorting is alphabetical, not numerical. "10" sorts before "2" because "1" comes before "2". If you need numeric order, pad numbers with leading zeros or sort them in a spreadsheet.
Reversing text
Reverse Text can reverse by characters, words or lines. It's rarely needed for cleanup, but reversing lines is handy for flipping a chronological list, such as log entries, to put the newest first.
A recipe for cleaning a pasted list
- Paste the text into the tool.
- Remove extra spaces, which also deletes empty lines.
- Fix the case to match your convention, lowercase for emails, for example.
- Remove duplicate lines.
- Sort if the order should be alphabetical.
- Skim the result for anything the tools can't judge, such as typos or names that should be capitalized.
Other common messes
- Curly quotes and odd dashes pasted from word processors can break code or CSV files. Replace them with plain characters where needed.
- Line breaks in the middle of sentences, common when copying from PDFs, need joining by hand.
- Mixed date formats and units need standardizing before sorting.
- Hidden characters, such as non-breaking spaces, can make visually identical lines count as different.
Where this helps
- Email and contact lists: remove repeats before a mailing.
- SEO and keyword lists: merge lists from several tools without duplicates.
- Writing and editing: fix capitalization after a document has been pasted around.
- Data preparation: clean a column of values before importing it.
- Code and configuration: convert names between camelCase, snake_case and kebab-case. For URLs specifically, the Slug Generator turns any title into a clean URL slug.
When you're done, a quick check with the Word Counter confirms the text is the length you want, as covered in our word count guide.
The short version
Most text mess comes down to case, spaces, duplicates and order. Fix spaces first, then case, then duplicates, then sort. Remember that the tools are literal: they won't know which words are proper nouns or which lines are near-duplicates, so give the result a short read before you use it.