Dev TooloraLocal dev tools

> Text

Wrap/Unwrap Text

Wrap by Unicode graphemes or join physical lines with explicit paragraph, spacing and line-ending rules, then inspect the changes.

Runs locallyWorks offline
Back to results
Input

Source data

Mode
Long tokens
Keep may exceed width. Break splits only long tokens, on grapheme boundaries, starting them on a new line when needed. Indentation must leave room for content.
Inserted line endings
Only inserted breaks use this setting. Match uses the current source line’s terminator, or the first source terminator for an unterminated line; otherwise LF.
Spacing
Preserve keeps interior/trailing ASCII spaces and tabs, except a gap used for a wrap break becomes the new terminator. Collapse makes interior runs one space and trims eligible trailing/join-edge spacing; first-line indentation and kept blank rows remain.
Preview
Output

Result

Your result will appear here.

Tool guide

About this tool.

  • Wrapping inserts actual line terminators, not just visual soft wrapping in an editor. Each existing physical line is processed independently, with its original final terminator preserved.
  • Unwrapping replaces eligible internal line terminators with a space or no separator. Paragraph boundaries and final terminators are preserved by default.
  • Width counts Unicode grapheme clusters: a combining-accent character or joined emoji can count as one unit. This is not pixel width, terminal columns or a tab-stop calculation.

  • Prepare plain-text prose for a chosen grapheme width.
  • Join hard-wrapped copied text without losing blank paragraph separators.
  • Inspect line-ending changes or explicitly choose the endings of newly inserted breaks.
  • Keep long URLs intact, or deliberately split long tokens without cutting Unicode grapheme clusters.

Paste text or apply a complete sample. Empty and whitespace-only inputs are valid.

Wrap: choose width, long-token behavior and inserted line endings. Existing hard line boundaries stay; to reflow an already wrapped paragraph, unwrap it first and use that result as the next input.

Unwrap: choose paragraph boundaries and join separator. Width, long-token and inserted-ending draft settings are hidden and ignored.

Choose Preserve spacing or the explicit ASCII spacing cleanup. Inspect Changes before replacing input: joining and gap replacement can alter prose, Markdown or code semantics.

Run and save reflowed-text.txt for exact output. JSON audit exports original text, output, settings, break counts and available comparison as reflow-report.json. Samples reset all eight settings.

  • Width 10: one two three → one two / three.
  • Width 10 with indentation: " one two three four" → " one two" / " three" / " four".
  • Keep long tokens: abcdef at width 3 → abcdef, reported as over-width. Break long tokens → abc / def.
  • Width 12: well-known hyphen-ated words here → well-known / hyphen-ated / words here; hyphens are not break points.
  • Unwrap with paragraphs kept: one / two / blank / three / four → one two / blank / three four.
  • Unwrap, No separator, Collapse spacing: https://example. / " test/path" → https://example.test/path.

  • Wrapping processes each physical line independently. It does not automatically merge earlier hard wraps, parse paragraphs or preserve Markdown list markers as hanging indentation. Leading ASCII indentation is repeated on each continuation.
  • Normal break opportunities are ASCII spaces/tabs. NBSP, narrow NBSP, zero-width characters and non-ASCII line separators are not treated as horizontal break gaps. CJK text without ASCII gaps is one token; opt-in long-token breaking may split it or a token containing NBSP.
  • Preserve does not mean byte-identical whitespace at a break: the entire horizontal gap selected for wrapping is replaced by an inserted terminator. Other horizontal runs, indentation, trailing padding and blank bodies are retained. Collapse intentionally reduces ASCII interior spacing and eligible trailing/join edges.
  • Unwrap Preserve replaces only eligible internal terminators and retains both neighboring bodies, including indentation and trailing spaces. It can therefore produce multiple adjacent spaces. Collapse keeps the first row’s indentation but trims continuation/join-edge ASCII spacing.
  • A paragraph separator is empty or only ASCII spaces/tabs. Keep preserves those rows and their raw terminators. Join all is an explicit operation across blank separators; an empty row adds no separator of its own, so one / blank / two → one two. Final terminators are never replaced with trailing spaces.
  • Original CRLF, CR and LF spellings survive except internal terminators explicitly joined by Unwrap. Inserted-ending settings never normalize existing terminators. A final newline is not an extra empty physical row.
  • Width counts grapheme clusters using Intl.Segmenter. A tab counts as one, not an expanded tab stop; wide CJK glyphs and emoji need not occupy one terminal column. Segmentation depends on runtime Unicode data; no UTF-16 splitting fallback is used.
  • Keep long tokens, retained indentation, trailing padding and blank rows can produce over-width output. The summary counts these lines. Break mode errors if indentation alone consumes the available width, and does not trim trailing padding to force a width limit.
  • Input is limited to 100,000 UTF-16 units and 10,000 physical lines, width to 1–1,000, output to 1,000,000 UTF-16 units. NUL, unpaired surrogates and invalid active settings are rejected without truncation. Generated output can exceed a later run’s input budget.
  • Untouched samples and VS Code source drafts retain raw terminators. User-edited browser textareas normalize line endings to LF and that edited text becomes the actual input.
  • Changes initially shows 100 aligned rows. If text/line/diff limits prevent comparison, wrapping still succeeds with exact output; the audit explains why the visual comparison is unavailable. No diff markers or summary footer enter the TXT export.
  • Wrap and Unwrap are not guaranteed inverses. Hyphenation, sentence boundaries, code syntax, Markdown hard breaks and display width are not inferred. The audit contains your original text as well as the result.

FAQ

Questions about Wrap/Unwrap Text

Does the width count characters, columns or pixels?

Width counts grapheme clusters, so an emoji sequence, an accented letter and a tab each count as one. It does not measure pixels or terminal columns, so wide CJK characters can look longer than the limit.

How do I reflow a paragraph that is already hard-wrapped?

Run Unwrap first to join its lines, then run Wrap on that result with the new width. Wrap alone keeps existing line breaks and only splits lines that are too long.

Will it break long URLs or words?

Not by default: Keep intact leaves a long token on its own over-width line, and the summary counts it. Choose Break by grapheme to split it, so abcdef at width 3 → abc / def.

Does it break lines at hyphens?

No. Only ASCII spaces and tabs are break points, so well-known and hyphen-ated stay whole at width 12. Text without spaces, such as Chinese, is one token unless you choose Break by grapheme.

How do I join lines into one paragraph?

Choose Unwrap. With Keep paragraphs, one / two / blank / three / four → one two / blank / three four; Join all lines also merges across blank lines.

Is indentation kept on wrapped lines?

Yes. Leading spaces and tabs are repeated on each continuation line, so “ one two three four” at width 10 → “ one two” / “ three” / “ four”. List markers such as - are not treated as hanging indents.

Continue with

Text DiffAlign two texts by actual line changes, inspect both versions and export a complete comparison report.Whitespace CleanerClean spacing with explicit controls, preserve indentation and line endings, and inspect invisible changes before exporting.Prefix/Suffix LinesAdd or remove literal line prefixes and suffixes, preserve indentation and raw line endings, and choose how blank or already-affixed lines behave.Text StatisticsUnderstand Unicode text length, words, lines, UTF-8 size and estimated reading time.