Wrap text lines
Paste a long paragraph or a commit message and get lines no longer than the width you pick. Words stay whole, blank lines keep paragraphs apart and indents are repeated on the wrapped lines.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Paste the text.
- Choose the number of characters per line. 72 and 80 are the usual widths for email and source files.
- Turn on joining if the lines were broken at a different width before.
- Press Copy.
How it works
The text is read paragraph by paragraph; a blank line ends a paragraph and is kept. The words of each line (or of each paragraph when the lines are joined) are added to the current output line while the line, with one space between words, still fits in the width. When the next word would not fit, a new line starts.
Worked example
“The quick brown fox jumps over the lazy dog” is 43 characters. At width 20, “The quick brown fox” takes 19, and adding “ jumps” would make 25, so the first line ends there. The next line is “jumps over the lazy” (19) and the last is “dog”.
Tips
Mail programs and many style guides use 72 characters for plain text and 80 for code, but these are conventions, not rules. A line of exactly the chosen width is allowed. Only spaces and tabs count as breaks between words, so a long line without spaces is never wrapped unless you turn on cutting.
Frequently asked questions
What is the difference between hard wrap and soft wrap?
Soft wrap only changes how a line is shown and adds nothing to the text. Hard wrap, which this tool does, inserts real line breaks into the text itself, so it looks the same everywhere.
Are words ever split?
Not by default. A word longer than the width stays whole on its own line and sticks out. Turn on "Cut words longer than the width" to break such words at the limit, for example for long links or hashes.
When should I join the lines of a paragraph first?
Use it when the text was already wrapped at another width, such as an email copied from a narrow window. The lines of each paragraph are joined and wrapped again. Leave it off for poems, lists and code, where every line break matters.
How is the width counted?
In visible characters, so an accented letter or an emoji counts as one. A tab counts as one character too, not as the width of the tab stop.
What about spaces and indents?
Runs of spaces between words become one space. The indent of the first line of each paragraph, or of each line when the lines are not joined, is repeated on the wrapped lines.