Remove Line Breaks and Extra Spaces - Join Lines, Fix Text from a PDF
Paste text and every line break is replaced as you type, with a space, a comma, nothing or text of your own.
Maintained by Hirantha Sandaruwan Lakshan. Updated 13 October 2026.
About this tool
Extra spaces can be collapsed, blank lines kept as paragraph breaks, and, for text copied from a PDF, words that were split with a hyphen at the end of a line can be joined again. It handles Windows, Unix and old Mac line endings and nothing leaves your browser.
How it works
The tool recognises these line breaks: LF (Unix, Linux and macOS), CRLF (Windows), CR (classic Mac OS), the Unicode line separator U+2028 and paragraph separator U+2029, and also NEL (U+0085), the vertical tab and the form feed, because text copied from PDFs often contains form feeds at page ends. A CRLF counts as one break. Browser text boxes convert line breaks to LF when you paste, and a file you open can keep its own, so both are handled.
Each line is trimmed (optional), runs of spaces, tabs and non-breaking spaces are collapsed into one space (optional), lines with nothing on them are dropped, and the remaining lines are joined with what you choose: a space, nothing, a comma, a comma and a space, or text of your own. A space is the default because it keeps words apart. 'Nothing' suits text where a break falls inside a word or in a long number or code.
With 'Keep paragraph breaks' a blank line (or a line with only spaces) separates paragraphs. Each paragraph is joined into one line and the paragraphs are separated by exactly one blank line, however many blank lines were between them. Without it, all paragraphs run together into one line.
'Join hyphenated words' is for text copied from a PDF or a printed layout, where a long word is split with a hyphen at the end of a line. When the option is on, a hyphen at the end of a line is removed and the two halves are joined without a space, but only if a letter comes directly before the hyphen and the next line starts with a letter that is not a capital. A soft hyphen (U+00AD), which only marks where a word may break, is removed whenever a letter follows. The tool cannot know whether the hyphen belonged to the word, so 'well-' followed by 'known' becomes 'wellknown'. That is why the option is off by default and why you should read the result. Numbers, capitals, dashes and spaced hyphens are left alone.
Worked examples
Text copied from a PDF
'The committee met on Tuesday to discuss the new', 'timetable. Several members raised con-', 'cerns ...' and so on, with a blank line before 'A decision was post-' and 'poned ...'. With 'Join hyphenated words' and 'Keep paragraph breaks' on, you get two paragraphs, 'concerns' and 'postponed' are whole again, and the summary reports 5 line breaks removed and 2 hyphenated words rejoined.
A list as one line
red, green, blue and yellow on four lines become 'red, green, blue, yellow' with 'Comma and space'. The same list with 'A space' is 'red green blue yellow'.
Your own separator
Choose 'Your own text' and type ' | ' (with the spaces) to get red | green | blue | yellow.
Extra spaces
'a b ' on one line and ' c<tab> d' on the next become 'a b c d': each line is trimmed, and every run of spaces or tabs becomes one space.
Line breaks this tool removes
| Name | Code | Where you meet it |
|---|---|---|
| LF (line feed) | U+000A | Unix, Linux, macOS and most web text |
| CRLF | U+000D U+000A | Windows and MS-DOS files; counted as one break |
| CR (carriage return) | U+000D | classic Mac OS files and some old systems |
| VT (vertical tab) | U+000B | a rare control character |
| FF (form feed) | U+000C | page breaks, often at the end of each page in text copied from a PDF |
| NEL (next line) | U+0085 | a rare control character |
| LS (line separator) | U+2028 | Unicode; JavaScript treats it as a line terminator |
| PS (paragraph separator) | U+2029 | Unicode; JavaScript treats it as a line terminator |
Frequently asked questions
How do I remove line breaks from text?
Paste the text into the box. Every line break is replaced by a space as you type, and the result appears below with Copy and Download buttons. Choose a different joiner (nothing, a comma, your own text) if you need one.
How do I remove line breaks but keep the paragraphs?
Tick 'Keep paragraph breaks'. Each paragraph becomes one line and a single blank line stays between paragraphs. A paragraph is a group of lines separated by a blank line.
How do I fix text copied from a PDF?
Paste it, tick 'Keep paragraph breaks' if you want paragraphs, and tick 'Join hyphenated words' to rejoin words split at the end of a line. Then read the result, because a real hyphen at a line end, as in well-known, is also removed.
How do I replace line breaks with commas?
Choose 'A comma' or 'Comma and space' under 'Put this where each line break was'. A list with one item per line becomes a comma-separated list on one line.
Why are there still double spaces in my text?
Make sure 'Collapse extra spaces' is ticked. It turns every run of spaces, tabs and non-breaking spaces into one space. With it off, spaces inside a line are left as they are.
Does it remove blank lines?
Yes, unless 'Keep paragraph breaks' is on, in which case one blank line is kept between paragraphs. A line with only spaces counts as blank.
Can I remove extra spaces without joining the lines?
Not with this tool, which always joins the lines. To tidy spaces while keeping the lines, use a find and replace tool with a regular expression such as two or more spaces replaced by one.
Will it join words that should keep their hyphen?
Only if 'Join hyphenated words' is on, and then only when a hyphen ends a line, follows a letter and is followed by a line that starts with a small letter. A compound word such as well-known split across two lines will lose its hyphen, so read the result.
How much text can it handle, and is it sent anywhere?
Up to 5 million characters at once, about 5 MB of text, and it never leaves your browser. A longer text is refused with a message and nothing is changed.
Sources & references
Updated Oct 13, 2026