Toolstia / Remove line breaks

Remove line breaks from text

Hard line breaks cause trouble whenever text moves between systems. A paragraph copied from a PDF arrives with a break at the end of every printed line, an email quoted in a narrow window keeps its wrapping, and a list pasted from a spreadsheet column needs to become a single line for a search box, a tag field or a command.

This tool turns those breaks into whatever you need. You choose the replacement: a space for normal prose, nothing at all to glue lines together, a comma and a space to build a list, or any text of your own such as a semicolon or a pipe. You can keep real paragraph breaks, collapse repeated spaces, and trim the ends of every line.

A counter shows how many line breaks were in your text, and the cleaned result updates as you change the options. It does not guess at meaning, so you stay in control of what is joined and what is not.

Paste some text to start.

How it works

  1. Paste your text.
  2. Choose what to put in place of each line break, and tick Keep blank lines if you have paragraphs.
  3. Copy the cleaned text.

Why copied text breaks

PDFs and some websites store each printed line separately, so copying gives you a break after every line. Pasted into a document, it looks ragged and does not resize with the page.

Keeping paragraphs

Turn on Keep blank lines between paragraphs to remove only the single breaks inside a paragraph. A blank line is treated as the end of a paragraph and is kept as one empty line.

What replaces the break

A space is right for sentences. Choose Nothing to glue lines together, or a comma and space to turn a list into one line. You can also type your own text, such as a semicolon.

Windows and Mac line endings

Different systems end lines in different ways, and all of them are handled. Repeated spaces left behind can be turned into one.

Example: a PDF paragraph, with and without paragraph breaks

Paste these lines: The quick brown fox, jumped over the, lazy dog. Then it, ran away., an empty line, Second para starts, here and ends. With the default settings the result is one line: The quick brown fox jumped over the lazy dog. Then it ran away. Second para starts here and ends. The two paragraphs have merged, because every break, including the blank line, was removed.

Now tick Keep blank lines between paragraphs. The result is two paragraphs separated by one empty line, with the first reading The quick brown fox jumped over the lazy dog. Then it ran away. That is almost always what you want when the source has real paragraph spacing.

Building lists: commas, semicolons and custom separators

Set the replacement to a comma and a space and the three lines one, two and three become one, two, three. Choose Something else, type a semicolon followed by a space, and you get one; two; three. This is handy for turning a column of email addresses, tags, product codes or keywords into a single line for a form that expects a separated list.

Choose Nothing to join lines directly, which is useful for pieces of a long code, number or URL that were wrapped across lines. Keep an eye on the spacing around your custom text, since it is inserted exactly as typed.

Hyphenated words and what the tool cannot know

PDFs often break long words at the end of a line with a hyphen. After joining, the text exam- ple word keeps its hyphen and a space, because the tool cannot tell a break hyphen from a real one, as in well-known or twenty-one. Search for the hyphen followed by a space and fix those few spots with find and replace, once you have decided that none of them is a real hyphen.

The tool also cannot see paragraphs that are separated only by an indent or only by a single line break. If the source has no blank lines between paragraphs, the result will be one large block.

The trim and collapse options

Trimming removes spaces at the start and end of each line before they are joined, so a line that ended with a space does not produce a double space. With trimming on, empty lines inside the text are also dropped when joined.

Turning repeated spaces into one handles gaps that were in the source, such as justified text with wide spacing. It only deals with runs of ordinary spaces, not tabs. If you need to remove tabs and other gaps as well, the remove extra spaces tool is the better partner.

When you should keep the line breaks

Do not join lines in poems, addresses, code, lyrics, or any text where the line is itself the unit. Joining a postal address into one line may be fine for a single field, but joining a poem destroys its structure. In those cases it is better to change only the blank lines, or to convert the breaks into a visible separator such as a slash that you can undo later.

Questions

Will it fix words split with a hyphen at the end of a line?

No. A hyphen is left where it is, so check those words by eye.

Does it work with Bangla text?

Yes. Any text works.

Can I add line breaks back?

Use the find and replace tool to turn a chosen mark back into line breaks.

Is anything uploaded?

No. Your text stays in your browser and is never sent anywhere.

Why did my paragraphs merge into one block?

Keep blank lines between paragraphs was off, so every break was removed, including the empty lines. Tick that option and run it again.

How do I turn a column of items into one comma-separated line?

Paste the column, set the replacement to a comma and a space, and copy the result. Trimming is on by default, so stray spaces around items are cleaned.

Does it work with Windows line breaks?

Yes. Windows, Unix and older Mac line endings are all treated as line breaks.

Can it join lines without leaving any gap?

Yes. Choose Nothing as the replacement. Words that were at the end and the start of two lines will then be joined directly, so use it for codes or numbers rather than for prose.

Why do I still see double spaces?

The option to turn repeated spaces into one may be off. Turn it on, or use the remove extra spaces tool for tabs and other gaps.