How to Hard Wrap Text at 72 or 80 Columns (and Unwrap It)
Why email, git commits and code comments wrap at 72 or 80 columns, how to keep quote marks and list indents while wrapping, and how to undo a hard wrap.
&c=%230f766e&k=text)
Most editors wrap long lines on screen without changing the file. That is a soft wrap. A hard wrap is different: it inserts real line breaks so that no line is longer than a chosen number of characters. The text then looks the same in every program, from a terminal to a plain text email client.
Where hard wrapping still matters
Plain text email. The email standard recommends lines of no more than 78 characters. Many people wrap at 72 so that quoted replies, which add "> " to each line, still fit comfortably.
Git commit messages. The convention is a subject line of about 50 characters, a blank line, and a body wrapped at 72. Tools such as git log and many code review screens show the body as written, so unwrapped paragraphs run off the edge.
Code comments and documentation. Style guides set a maximum line length, commonly 79, 80 or 100 characters. Long comment paragraphs need wrapping to respect that.
Fixed-width printing and old systems. Receipts, mainframe forms and some data feeds accept only a fixed number of characters per line.
Wrapping without breaking structure
A naive wrap treats the whole text as one stream of words. Good wrapping understands what it is wrapping.
- Paragraphs stay separate; each one is filled on its own.
- Quote prefixes such as > and >> are repeated on every new line, so replies stay replies.
- Comment markers such as //, #, --, ; and % stay at the start of each line.
- List items get a hanging indent, so the continuation lines line up with the text and not with the bullet.
- Long words such as web addresses are either left whole or split, your choice.
- Chinese, Japanese and Korean characters are counted as two columns, because terminals display them twice as wide.
Using the tool
- Paste your text into Hard Wrap Text at Column Width.
- Choose a width with a preset (Email 72, Git commit 72, Code 80, Wide code 100) or type your own.
- Check the options. Quote prefixes and hanging indents are on by default. Turn on "Leave paragraphs whose lines already fit" if your text contains addresses, poems or code blocks that should keep their own breaks.
- Look at the preview. A ruler marks every tenth column and a red line shows the limit. Lines that still cross it are highlighted, usually because of one very long word.
- Copy or download the result.
Justify is available for the classic typewritten look, where extra spaces stretch each line to the full width. It reads well in a monospaced font but is not recommended for email, where it creates odd gaps.
Unwrapping
The reverse problem is just as common. You copy a paragraph out of a plain text email or a PDF and paste it into a word processor or a web form, and every line ends with a hard break. The text looks ragged and will not reflow.
Choose Unwrap. Each paragraph becomes one line again, while blank lines, list items and quote prefixes are kept. You can then paste the text anywhere, or wrap it again at a different width.
Tips
- Wrap commit message bodies but never the subject line.
- When replying to wrapped email, unwrap the quoted text first, then wrap the whole reply at 72 so the quotes do not turn into a zigzag of short and long lines.
- For code, wrap only comment blocks. Wrapping actual code changes its meaning in languages where line breaks matter.
- Widths are counted in characters, so the result lines up only in a monospaced font.
Everything is processed in your browser; nothing is uploaded.



