Skip to content

Text cleaner

Paste messy text, choose what to fix, and press Clean text. Each option shows how many places it will change.

0 characters, 0 lines Paste text to see what needs cleaning.
My text comes from
Spaces
Line breaks

To remove every line break, or to keep only the paragraphs, use remove line breaks.

Characters
Formatting
Advertisement
A crumpled page of text next to a smooth clean page, with a small broom sweeping loose marks away

Last checked by the TextEditor.com team

Where messy text comes from

Most mess comes from copying. Each program stores text its own way, and the copy brings those habits along. Pick the source under "My text comes from" and the tool turns on the right options.

Copied fromWhat goes wrongOption that fixes it
PDF filesA line break at the end of every line, words split with a hyphen, ligatures like "fi" as one characterJoin lines broken in a sentence, Rejoin words, Fancy letters and ligatures
Word and emailNo-break spaces, soft hyphens, ">" marks in replies, extra empty linesOdd spaces, Hidden characters, Email quote marks, Empty lines
Web pagesTabs and runs of spaces from the page layout, zero width spaces, HTML codes like &Repeated spaces, Tabs, Hidden characters, Remove HTML tags
Chat apps and social postsBold or script letters from font generators, zero width joiners, direction marksFancy letters, Hidden characters
SpreadsheetsTabs between cells, spaces at the end of cellsTabs, Remove spaces at line ends

How to fix line breaks in text from a PDF

A PDF does not store paragraphs. It stores each line of text at a spot on the page. When you copy, every line ends with a line break, even in the middle of a sentence.

"Join lines broken in a sentence" puts the lines back together. It keeps a break after an empty line, before a list item, before an indented line, and after a short line that ends with a period. Those are the usual signs of a new paragraph. A word split with a hyphen at the end of a line ("exam-" and "ple") is put back together when the next line starts with a small letter.

Try it: lines from a PDF
After "Join lines"
Old printers set each line by hand. A long word at the end of a line was split with a hyphen, like this example, so the edge stayed straight.
A new paragraph starts here, and a copy from a PDF still breaks it into short lines.

Change the text on the left. The tool guesses from line lengths, so read the result once before you use it.

Hidden characters you cannot see

Some characters take up no space at all. A zero width space (U+200B) tells a browser where a long word may wrap. A zero width joiner (U+200D) glues emoji together, so 👨‍👩‍👧 shows as one family emoji. They are useful where they belong, but copied into a name, a password or a spreadsheet they break searches and matches.

Two words that look the same

hello 5 charactershello 6 characters

The second word has a zero width space between "hel" and "lo". A search for "hello" does not find it.

CharacterCode pointWhere it comes fromRemoved?
Zero width spaceU+200BWeb pages, chat apps, some CMS editorsYes
Zero width joinerU+200DEmoji sequences, Indian scriptsOnly outside emoji and words
Zero width non-joinerU+200CPersian, Hindi and other scriptsOnly outside words
Byte order markU+FEFFThe start of files saved by older Windows toolsYes
Soft hyphenU+00ADWord and web pages, marks where a word may breakYes
Word joinerU+2060Typesetting, keeps two parts on one lineYes
Right to left overrideU+202ETricks that flip text, like a file name that hides its real endingYes
Left and right marksU+200E, U+200FArabic and Hebrew textKept when the text has Arabic or Hebrew letters
Variation selectorsU+FE00 to U+FE0FEmoji style, like the red heart ❤️One right after a character stays. A long run of them can hide data, so it goes.

To see each hidden character by name before you remove it, paste your text into the hidden character finder. Wikipedia has more about the zero width space.

Spaces that are not normal spaces

Unicode has more than a dozen spaces. Word puts a no-break space (U+00A0) where you press Ctrl+Shift+Space, and web pages write it as  . It looks like a normal space, so a search for two words with a normal space between them misses it.

Computers add them too. In late 2022 the Unicode locale data (CLDR 42) put a narrow no-break space (U+202F) between the time and "PM" in English. Chrome and Firefox went back to a normal space after some sites broke, but other programs still write it.

What your browser writes for the time

3:45 PM Turn on JavaScript to check your browser.

SpaceCode pointWidth between two bars
Normal spaceU+0020| |
No-break spaceU+00A0| |
Narrow no-break spaceU+202F| |
Thin spaceU+2009| |
Em spaceU+2003| |
Ideographic spaceU+3000| |

"Odd spaces to normal spaces" turns all of them into the space from your keyboard (U+0020). Turn it off for French text, where a no-break space before "!" and "?" is part of the spelling.

Advertisement

Curly quotes, dashes and fancy letters

Word and phones change straight quotes into curly ones as you type. That looks right in a letter. In code, a CSV file or a command, a curly quote is a different character and causes errors.

The dash option changes the en dash (U+2013), the em dash (U+2014) and the minus sign (U+2212) into the keyboard hyphen (U+002D). The ellipsis character (U+2026) becomes three dots.

Fancy letters from font generators are math symbols, like the bold 𝐀 (U+1D400). The tool turns them back into plain letters with Unicode NFKC, the same rule that splits the "fi" ligature (U+FB01) into "f" and "i". Signs like ™, ½ and ² stay as they are.

Type or paste a line
Plain lettersBold and script, a fine “quote”, Wide letters
Plus straight quotesBold and script, a fine "quote", Wide letters

To make fancy letters on purpose, use the font converter.

Line endings: Windows, Mac and Linux

A line break is one or two hidden characters. Windows uses two, a carriage return and a line feed (CRLF, U+000D U+000A). Mac and Linux use only the line feed (LF, U+000A).

Most programs read both today. Windows Notepad learned to show LF files in 2018, with Windows 10 version 1809, as Microsoft explains in its Notepad post. Some older Windows tools still show everything on one line. Pick "CRLF (Windows)" under Line endings, and the copy and the download use two characters per break.

What the cleaner never changes

Letters, digits and punctuation stay as they are, except for the options you turn on under Characters. Emoji stay whole, with their skin tones and joiners. Arabic and Hebrew text keeps the marks that set its direction. Use Preview changes before you clean, and Undo if you do not like the result.

More ways to fix text

Frequently asked questions

How do I remove line breaks from text copied from a PDF?

Paste the text, press "Text from a PDF" and then Clean text. Lines broken in the middle of a sentence are joined, and paragraphs stay apart. Check Preview changes first if the text has lists or tables.

How do I find hidden characters in my text?

Paste the text and press Show hidden characters. Each hidden character shows as a small label, like ZWSP for a zero width space, with its code point when you point at it. The list at the top counts each kind.

Why does my text look the same after cleaning?

Most changes are to characters you cannot see, like double spaces, no-break spaces and zero width spaces. Press Preview changes before you clean to see each one marked in color.

How do I remove duplicate lines?

Paste your list into remove duplicate lines. It keeps the original order, can ignore case and extra spaces, and tells you how many lines it removed.

How do I remove all line breaks and make one paragraph?

Use remove line breaks and pick One line. You can also keep the empty lines between paragraphs, or put a comma in place of each break.

Will the cleaner change my words?

No. It only changes spaces, line breaks and the characters named in the options you turn on. Fancy letters, curly quotes and dashes change only when their option is on.

Is my text uploaded?

No. The cleaner runs in your browser. Your text is saved only in this browser, so it is still there after a reload.

  • Text editorWrite and edit plain text in your browser.
  • Invisible characterCopy an invisible character or blank space for empty names and messages.
  • Word counterCount words, sentences and paragraphs as you type.
  • Text comparePaste two texts and see every changed line and word highlighted side by side.
  • NotepadKeep several notes in one place.
  • PDF to textGet the text out of a PDF file.

↑ ↓ to choose, Enter to open, Esc to close