Hard Wrap Text at Column Width

Set a width such as 72, and each paragraph is broken into lines that fit, with > quotes, // comments and list items indented correctly; unwrap reverses it.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Paste the text

    Paste it or open a text file.

  2. 2
    Set the width

    Type a column number or tap a preset such as Email 72 or Code 80.

  3. 3
    Choose the rules

    Quote prefixes, hanging indents, splitting long words, justify and East Asian width.

  4. 4
    Wrap or unwrap

    Choose Wrap at column, or Unwrap to make one line per paragraph.

  5. 5
    Check the preview

    Look for highlighted lines that are still over the limit.

  6. 6
    Copy

    Copy or download the result, or apply it to the input to keep editing.

About this tool

A hard wrap puts real line breaks into text so that no line is longer than a set number of characters. Plain text email has used 72 to 78 columns for decades, and RFC 5322 still recommends lines of no more than 78 characters. Git commit message bodies are wrapped at 72 so they read well in a terminal and in git log, Python's PEP 8 asks for 79 columns and comments of 72, and many code style guides use 80 or 100. Mailing lists, plain text documentation, README files and fixed-width printers all expect the same. This tool wraps each paragraph at the width you choose. A blank line separates paragraphs, and each paragraph is filled with as many words as fit. Quote prefixes are recognised and repeated on every new line, so a > or >> reply block in an email stays a reply block, and the same goes for // and # comments, -- in SQL and Lua, ; in Lisp and assembly and % in LaTeX. List items that start with -, *, •, 1. or a) get a hanging indent, so the second line of an item starts under the text, not under the bullet. Words longer than the width, such as web addresses, are left whole by default or split if you choose. Justify adds spaces between words to make every line except the last of a paragraph exactly the full width, as in old typewritten reports. Chinese, Japanese and Korean characters count as two columns, the way terminals show them, and can break between any two characters. Unwrap does the reverse: it joins the lines of each paragraph back into one long line, which is what you need before pasting wrapped email text into a word processor or a web form.

Choosing a width

72 is the safe choice for email and commit bodies because a reply adds > to each line, and quoted text still fits in 80 columns. 66 characters is a classic comfortable reading measure for printed text. 80 and 100 suit source code. Use the preset buttons or type any width from 10 to 400.

The preview

The preview shows a ruler with a mark every five and ten columns, a red line at the limit, and highlights any line that is still too long. A long line after wrapping is nearly always a single long word or web address; turn on Split words to break it, or leave it whole so links keep working.

Keeping lines that already fit

Addresses, poems, code blocks and signature blocks should not be refilled. With Leave paragraphs whose lines already fit on, any paragraph in which every line is within the width keeps its own line breaks, and only paragraphs with long lines are rewrapped.

Limits

Width is counted in characters, not in pixels, so the result lines up only in a monospaced font; in a proportional font lines will look uneven. Combining accents count as zero columns and emoji as one, which can differ from some terminals. Tabs are not expanded. Markdown tables and indented code inside a paragraph are wrapped like prose unless Leave paragraphs that fit is on. Your text is processed only in this browser.

Worked example

A 1,050-character reply with a quoted paragraph, a three-item list and a code comment is wrapped at 72. The quoted paragraph becomes 4 lines that each start with >, the list items become 2, 1 and 2 lines with the continuation lines indented by two spaces, and the comment becomes 2 lines that each start with //. The longest line drops from 231 to 71 characters and no line is over the limit. Unwrap then turns the 14 lines back into 6 paragraph lines.

Quick facts

Frequently asked questions

What is the difference between hard wrap and soft wrap?

Soft wrap is what an editor does on screen: long lines are displayed on several rows but the file still has one line. Hard wrap inserts real line break characters, so the text keeps its shape in every program.

Why 72 characters for email?

Each level of reply adds > and a space. Starting at 72 leaves room for a few levels of quoting before lines pass 78 to 80 characters, the limit that RFC 5322 recommends and that terminals show without scrolling.

Will it break my bullet points?

No. Lines starting with -, *, +, •, a number with a dot or bracket, or a letter with a bracket begin a new item, and their continuation lines are indented to line up with the text.

How do I fix text that was wrapped in the wrong place?

Choose Unwrap to join the lines of each paragraph, then wrap again at the width you want. Blank lines, list items and quote prefixes are kept.

Can it wrap code comments?

Yes. Lines that start with //, #, --, ; or % keep the marker on each new line. Wrap only the comment part of a file; code lines themselves should not be refilled.

Is anything uploaded?

No. Wrapping runs in your browser and the text is kept only in this browser for undo and redo.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages