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.
Often used alongside Paragraph Order Randomizer, String Line Filter and Find & Replace Tool.
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.
- Trims each line before joining it, so the indentation many wrapping tools leave behind does not become stray double spaces mid-sentence.
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.
- Joins with a single space unconditionally, so a line that broke mid-way through a hyphenated word gains a space where none belongs.
Examples
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.
- Unwrap before editing text that arrived hard-wrapped, since editing it in place leaves the line lengths ragged and inconsistent.
- Lift indented code blocks out of the text first, because their line breaks carry meaning and will be flattened along with the prose.
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.
- Unwrapping text containing a code block or ASCII table, where every line break matters and the structure is destroyed in one pass.
Tips
- Run the Text Statistics tool afterward to confirm the paragraph count matches what you expect once the text is unwrapped.
- Blank lines containing only whitespace still count as paragraph breaks, so text whose blank lines carry trailing spaces unwraps correctly.