TextToolboxTextToolbox

Word Wrap Tool

Wrap text by grapheme width with soft, hard, paragraph reflow and indentation-aware modes.

Built by Saurabh Kumar

Quick Answer

Wrap existing lines or reflow paragraphs using grapheme boundaries. Keep long words by default, choose explicit breaking or literal hyphens, and review indentation and whitespace before export.

Spaces at wrap boundaries remain in the output. Width counts graphemes, including literal tabs, rather than screen columns. Code Wrap repeats leading indentation but does not parse code.

0 output lines; longest 0 graphemes

What Is Word Wrap Tool?

Reformat long plain-text lines with four distinct workflows. Soft Wrap respects existing lines and prefers ASCII spaces or tabs. Hard Wrap cuts at grapheme boundaries. Paragraph Wrap joins adjacent nonblank lines before wrapping. Code Wrap repeats leading indentation on continuations.

How to Use Word Wrap Tool

Paste text, choose a mode and enter a width from 10 to 500. Keep long words by default, or choose Break or literal Hyphenate when splitting is acceptable. Remove leading ASCII indentation only if you intend to change it. Mixed whitespace-and-mark graphemes are retained whole. Review trailing spaces and copy or download TXT.

How Word Wrap Tool Works

Each input line is segmented into grapheme clusters using Intl.Segmenter. Soft modes choose the last ASCII whitespace cluster within the available width; the whitespace stays with the preceding line. Keep can exceed width. Hyphenate inserts a literal hyphen without dictionary or language rules. Hard ignores the long-word choice. Paragraph mode replaces each internal physical separator with one ASCII space, retaining blank boundary lines. Code mode subtracts indentation from available width and reports an error if no room remains.

See Unicode text segmentation for the difference between grapheme boundaries and language-aware line breaking. Runtime Unicode versions may differ.

Word Wrap Tool Example

Width 10 illustrates why the mode matters. New line markers in the table describe actual output separators; trailing space is spelled out.

Exact settings and outcomes
Input and settingResult
Soft, alpha beta gammaalpha + trailing space, then new line + beta gamma
Paragraph, alpha + new line + betaalpha beta
Hard, 123456789 followed by a joined emojiNine digits and one complete emoji fit in the first ten graphemes
Code, ten leading spaces + A, width 10Error: indentation leaves no room

When to Use Word Wrap Tool

Prose drafts

Reflow pasted paragraph lines while keeping blank boundaries.

Fixed-unit samples

Use Hard to compare grapheme chunks without splitting joined characters.

Indented notes

Repeat indentation in plain-text examples, then review the width.

Common Mistakes

Wrapping changes physical lines, unlike visual wrapping in a text editor. Code Wrap can break executable syntax, literals or identifiers. Paragraph reflow changes existing line boundaries and adds spaces. Graphemes are not terminal cells, bytes or pixels; CJK text and tabs may display wider. Whitespace-only lines remain unwrapped and may exceed width. Blank lines and original CRLF/LF/CR boundaries remain unless indentation removal is selected. Inserted wrap separators use the source line ending, or LF on an unterminated line.

Input is limited to 1,000,000 UTF-16 units and 20,000 physical lines. Output is limited to 5,000,000 units and 20,000 lines. Invalid settings clear output and disable export; these budgets are not a browser speed guarantee.

Tips for Better Results

Keep an original copy when changing paragraph structure or inserting hyphens. For indentation conversion, use the dedicated Tabs/Spaces tool before wrapping and inspect the result. The selected width is a formatting preference, not email or platform compliance.

Convert Tabs/Spaces and Center Text handle different spacing tasks.