Wrap any text at a column width you choose, such as 72 or 80 characters, with real line breaks that survive copy and paste. Add indents or a prefix like > or //, keep lists tidy, or switch to Unwrap to join wrapped lines back into paragraphs.
Last updated:
Advertisement
Advertisement
How to use the Word Wrap Tool
Paste your text into the left box, or press Load example to try it.
Choose Wrap or Unwrap with the tabs at the top.
Set the line width in characters (72 and 80 are classic for email and terminals) and any indent or prefix you need.
Pick how to treat long words and existing line breaks: re-flow paragraphs, or keep every line and wrap only the long ones.
Copy or download the result. Use as input lets you run a second pass, for example unwrapping and then re-wrapping at a new width.
How the word wrap works
The tool uses the same greedy line-filling method as classic Unix tools such as fold -s and fmt: it places words on a line one after another and starts a new line as soon as the next word would push the line past the width. In formula form, a word w is added to the current line when
where lead is the prefix plus the indent (only counted when Count prefix and indent in the width is ticked). If even an empty line cannot hold the word, the word either goes on a line of its own or, with Break words ticked, is cut into pieces of width − length(lead) characters (one less when a hyphen is added).
For example, with a width of 20 the sentence The quick brown fox jumps over the lazy dog becomes three lines: The quick brown fox (19), jumps over the lazy (19) and dog (3).
Common line widths
Width
Typical use
50 to 72
Git commit messages: subject line around 50, body wrapped at 72
72
Python comments and docstrings (PEP 8), plain-text email bodies
76 to 78
Plain-text email (RFC 5322 recommends no more than 78 characters per line)
79 to 80
Source code and terminal output; the traditional 80-column screen
100 to 120
Wider code style limits used by many modern projects
45 to 75
Comfortable reading measure for prose in typography guides
Tips
Quoting an email reply: set the prefix to > and the width to 72.
Code comments: use // or # as the prefix, and set the indent to match your code.
Re-wrapping old text: run Unwrap first, press Use as input, then Wrap at the new width. Or simply use Re-flow paragraphs, which does both in one step.
Hanging indent for references: set First-line indent to 0 and Indent for other lines to 4.
Frequently asked questions
What is the difference between soft wrap and hard wrap?
Soft wrap is only visual: an editor or browser flows the text to fit the window, but the text itself is still one long line. Hard wrap inserts real newline characters at the chosen width, so the text keeps the same shape when you paste it into an email, terminal, code file or another program. This tool produces hard wraps.
What line width should I use?
72 characters is the classic choice for plain-text email and Git commit message bodies, 76 to 78 is common for email as well, and 79 or 80 is the traditional limit for code and terminals (PEP 8 recommends 79 for Python code and 72 for comments and docstrings). 60 to 70 characters is also considered a comfortable reading measure for prose.
Does the width include the prefix and indent?
By default yes: with a width of 72 and the prefix "> ", every line including the prefix is at most 72 characters. Untick Count prefix and indent in the width if you want 72 characters of text after the prefix.
What happens to words longer than the line width?
By default a word that is longer than the line, such as a long URL, is placed on its own line and left intact, so links keep working. Tick Break words longer than the width to split it into pieces that fit, optionally ending each piece with a hyphen.
How do I remove the line breaks from wrapped text?
Switch to the Unwrap tab. Lines inside a paragraph are joined with spaces, blank lines between paragraphs are kept, list items stay on separate lines, and words that were hyphenated at a line end (like exam- / ple) are joined back together. You can also strip a quote prefix such as > from every line.
Are characters counted correctly for accents and emoji?
The tool counts Unicode code points, so accented letters and most emoji count as one character. Wide characters such as Chinese, Japanese and Korean, or some combined emoji, can look wider than one column in a monospaced font.
Is my text uploaded anywhere?
No. Wrapping and unwrapping happen entirely in your browser with JavaScript. The text and your settings are only remembered in this browser's local storage for your next visit.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.