Line Unwrapper

Undoes text that was hard-wrapped to a fixed column width by joining single newlines within a paragraph into spaces, while preserving blank lines as paragraph breaks, restoring flowing paragraphs. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-23

Overview

Introduction

Text copied from an email, a terminal, or an old plain-text document is often hard-wrapped to a fixed column width, leaving an awkward newline in the middle of every sentence.

This tool joins those wrapped lines back into flowing paragraphs for you, and it runs entirely client-side, so nothing you paste is ever uploaded to a server.

What Is Line Unwrapper?

An unwrapper that turns hard-wrapped text back into flowing paragraphs, joining single newlines within a paragraph into spaces while keeping blank-line paragraph breaks intact.

It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.

How Line Unwrapper Works

The text is first split into paragraphs on blank lines, then within each paragraph every remaining newline is trimmed and replaced with a single space, and the unwrapped paragraphs are rejoined with blank lines between them.

The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.

When To Use Line Unwrapper

Use it whenever you've pasted text that was hard-wrapped at a fixed width, like from an old email or a plain-text file, and want normal flowing paragraphs back.

It's a fast way to get the result without opening a text editor's find-and-replace, a REPL, or writing a one-off script just to check.

Features

Advantages

  • Distinguishes intentional paragraph breaks (blank lines) from incidental wrapping (single newlines), unlike a blanket newline-to-space replacement.
  • Trims stray whitespace left over from the wrapping.

Limitations

  • Cannot tell the difference between a hard-wrapped sentence and an intentional single-line list, so single-line lists without blank-line separators will be merged into one paragraph.

Examples

Unwrapping a hard-wrapped paragraph

Input

This is a line
that was wrapped
at a fixed width.

Output

This is a line that was wrapped at a fixed width.

The two internal newlines become spaces, restoring one flowing sentence.

Best Practices & Notes

Best Practices

  • Add a blank line between list items first if your source text is a list, so each item survives as its own paragraph instead of merging.

Developer Notes

Implemented as `input.split(/\n\s*\n/)` to isolate paragraphs, then each paragraph's internal lines are trimmed and joined with `.join(" ")`, and the paragraphs are rejoined with `\n\n`.

Line Unwrapper Use Cases

  • Restoring flowing paragraphs from an old plain-text email or file
  • Cleaning up text copied from a terminal or fixed-width source
  • Preparing hard-wrapped notes for further processing like word counting

Common Mistakes

  • Expecting single-line list items to stay separate; without a blank line between them, they get merged into one paragraph.

Tips

  • Run the Text Statistics tool afterward to confirm the paragraph count matches what you expect once the text is unwrapped.

References

Frequently Asked Questions