How to wrap text at a fixed width
To wrap text online at a width, paste it and choose the width. The tool fills each line with as many words as fit and starts a new line before the word that would go over. The Example text wrapped at 40 characters looks like this:
Wrapping text at a fixed width keeps
plain text readable in an email, a
terminal or a README. Set the width, and
every line is broken between words so
that none is longer than the limit.
A blank line starts a new paragraph, and
paragraphs are wrapped on their own.A blank line starts a new paragraph and is kept. Spaces at the end of a wrapped line are removed, and the space where a line was cut disappears, so no line starts or ends with a gap. The width counts characters, and an emoji or a letter with an accent counts as one.
Comments, quotes and lists keep their prefix
Plain wrapping breaks code comments and quoted email. The second line of a comment loses its slashes, and the second line of a quote is no longer quoted. With Keep // # > - prefixes on, the tool finds the marker at the start of the line and repeats it on every line it creates. The Code example at width 44 gives:
// This helper reads the settings file,
// merges it with the defaults and returns a
// frozen object that the rest of the
// application can share safely.
> Quoted replies keep their marker, so a
> long quoted line stays a quote after it is
> wrapped at the chosen width.
- A list item wraps with a hanging indent,
so the second line lines up under the
first word of the item.- Comment markers: //, ///, #, ##, -- and ; followed by a space. A word that only starts with a hash, such as #tag, is text.
- Quote markers: > and nested > > markers.
- List markers: -, * and + bullets, and numbers such as 1. and 2). The wrapped lines are indented to line up under the first word.
- Indentation: spaces and tabs at the start of the line are kept on every line, including inside a comment.
- A line with a javadoc star, one space then * and a space, keeps that star.
The prefix counts toward the width, so a line never goes past the limit because of it. If the prefix itself takes almost the whole width, a note tells you to raise the width. Turn the option off to treat everything on the line as text. Extra indent on wrapped lines in More options adds spaces to the second and later lines of a plain paragraph.
Word wrap or hard wrap, and what happens to long words
Word wrap breaks only at spaces. Hard wrap cuts at the exact width, even in the middle of a word, and keeps the spaces it finds. Use it for fixed-width fields and punched-card style formats, not for prose.
A word that is longer than the width, such as a URL, cannot be fitted by breaking at spaces. Long words set to Keep whole leaves it on its own line, a little past the limit, so the link still works. Break them cuts it into pieces of the full width. The status line and a note count the lines that go over the width.
Rejoin old line breaks before wrapping again
Text that was wrapped at 72 and now needs 80 would wrap into ragged short lines if the old breaks stayed. Set Existing line breaks to Rejoin paragraphs first. Lines of one paragraph are joined with a single space, then wrapped at the new width. The tool starts a new paragraph at a blank line, at a list marker, and when the prefix or the indentation changes, so quoted text, comments and lists are not run together.
Keep each line, the default, wraps every line on its own and leaves your line breaks where they are. That suits text where each line is already a unit, such as a list of sentences. To only join lines without wrapping, use Remove Line Breaks, which is the reverse of this tool.
Wrap text at 72 or 80 characters for commits, email and code
Many projects ask for commit message bodies wrapped at 72 characters, so the text still fits in a terminal after Git indents it. Plain text email is traditionally kept to about 76, and code style guides commonly use 80, 100 or 120. The presets cover these, and any width in between works. A commit body wrapped at 72 looks like this:
This body line is much longer than the rules of the project allow, so it
has to be wrapped at seventy two characters before it is committed.The subject line of a commit is a separate rule and is normally kept short, so wrap only the body. If you only want to cut text into parts of a given size, Text Splitter does that. Add Text to Each Line adds a prefix to lines after wrapping, and Remove Extra Spaces tidies spaces before it.
Wide characters, tabs and counting in columns
By default the width counts characters, and a character is what a person sees as one symbol, so an emoji with a joiner or a letter with a combining accent is one. A terminal draws Chinese, Japanese and Korean characters and many emoji two columns wide. Set Count width in to Columns and those count as two, and a tab counts as the tab width you pick, so the result fits a terminal of that width. Characters with no width, such as combining marks, count as zero.
Counting in columns uses a built-in list of wide characters. It follows the common East Asian width rules but is not a full copy of the Unicode tables, so check unusual symbols in your own terminal.
Limits and privacy
The page accepts up to 2 million characters. The preview shows the first 1,000 lines, while Copy and Download include everything. A markdown heading that starts with # is treated as a comment marker, so wrapping it repeats the hash on every line. Turn the prefix option off for such text.
The text is wrapped in your browser and is not sent to a server or stored. See the Privacy Policy for details.