How to remove line breaks
- Paste the text into the top box.
- Choose Keep paragraphs to join the lines inside each paragraph while keeping the gaps between paragraphs, or Remove all line breaks to turn everything into a single line.
- Pick what goes where each line break was – a space, nothing, or a comma – and tick the clean-up options you want.
- Click Copy result. The note next to the button tells you how many line breaks were removed.
Why copied text breaks in the middle of sentences
A PDF doesn't store paragraphs; it stores lines of text placed at fixed positions on a page. When you copy from it, most viewers put a hard line break at the end of every visual line, so the text falls apart as soon as you paste it into a document or a web form with a different width. Plain-text email has the same problem: messages are often wrapped at a fixed width (the email standard recommends lines of no more than 78 characters), and replies and forwards keep those breaks. Text recognised by OCR, terminal output and some subtitle files behave the same way. This tool rejoins the lines into normal, flowing paragraphs.
The two modes
- Keep paragraphs treats an empty line – even one containing only spaces or tabs – as the boundary between paragraphs. Lines inside each paragraph are joined; paragraphs in the result are separated by exactly one empty line, however many there were before.
- Remove all line breaks joins every non-empty line into one, so empty lines disappear too.
In both modes, spaces and tabs at the start and end of each line are removed before joining, so indentation and trailing spaces don't end up in the middle of a sentence.
The options
- Replace line breaks with – a space for normal text in languages that separate words with spaces; nothing for text that should be glued together directly, such as Chinese or Japanese; a comma, which actually inserts a comma followed by a space, to turn a list into one comma-separated line.
- Remove extra spaces (on by default) – any run of two or more spaces, tabs or non-breaking spaces becomes a single space. A single tab on its own is left alone.
- Join words split by a hyphen at the end of a line (off) – removes the hyphen and the break when a line ends in a letter followed by a hyphen and the next line starts with a lowercase letter.
Examples
Text from a PDF. This input is six lines long, so it contains five line breaks:
Line breaks copied from a PDF often appear in themiddle of a sentence, which makes the text hard toedit and reuse.- (empty line)
A second para-graph starts here.
With Keep paragraphs and the hyphen option on, the result is two clean paragraphs: “Line breaks copied from a PDF often appear in the middle of a sentence, which makes the text hard to edit and reuse.” and “A second paragraph starts here.” Three line breaks are removed and the empty line between the paragraphs stays. With the hyphen option off, the second paragraph would read “para- graph”.
A list to one line. apples, bananas and cherries on three lines, with Remove all line breaks and a comma, becomes apples, bananas, cherries – ready for a tag field, a spreadsheet cell or an email.
Where hyphen joining goes wrong. The hyphen rule can't tell a typesetting hyphen from a real one. well- at the end of a line followed by known becomes “wellknown”. On the other hand, COVID- followed by 19, or Jean- followed by Paul, is left alone because the next line doesn't start with a lowercase letter; those become “COVID- 19” and “Jean- Paul” and need a quick manual fix.
Practical uses
- Quoting a passage from a PDF report or e-book in your own document.
- Pasting into web forms and single-line fields that reject or mangle line breaks.
- Turning a column copied from a spreadsheet into a comma-separated list.
- Cleaning up subtitles, OCR output or old plain-text files before editing or translating them.
Tips
- For Chinese and Japanese, choose nothing. A space between two characters where a line used to wrap looks like a typo in those languages, and Remove extra spaces won't catch it because it is a single space.
- If your source separates paragraphs with a single line break instead of an empty line, Keep paragraphs can't see the boundaries and merges everything into one block. Add empty lines between paragraphs first.
- To check the length of the cleaned text, paste it into the Word Counter; its line count also confirms that no stray breaks are left.
FAQ
Does it handle Windows and Mac line endings?
Yes. Windows (CR LF), Unix and macOS (LF) and old Mac (CR) line endings are all recognised and treated the same way.
Why did all my paragraphs merge into one?
Either Remove all line breaks is selected, or there are no empty lines between your paragraphs. Keep paragraphs only keeps breaks that are followed by an empty line.
Will it remove spaces between words?
No. It only removes line breaks, spaces at the start and end of lines, and – if you leave the option on – doubled spaces. Single spaces between words are never touched.
Can I do the reverse and put each item on its own line?
Not with this tool; it only joins lines. Once you do have one item per line, Sort Lines and Remove Duplicate Lines can tidy the list.