How to use the Text Wrapper
- Paste your text into Your text.
- Set Line width in characters, anywhere from 5 to 500. The default is 40.
- Tick Split words longer than the width if long links or codes must not stick out past the edge.
- Copy the wrapped text.
What it does and when to use it
Most apps wrap text on screen automatically, but the line breaks are not saved. When text is going somewhere that does not reflow it, you need real line breaks at a fixed width. That is called hard wrapping. Use it for:
- plain-text emails and mailing-list posts;
- Git commit message bodies and code comments;
- README files, text files and terminal output;
- labels, receipts and other fixed-width printouts.
Hard wrapping also makes long lines readable in tools that do not wrap, such as some code editors and diff views.
The reverse job, joining hard-wrapped lines back into paragraphs, is done by the Text Unwrapper. If you only want one long line with no breaks at all, use Remove Line Breaks. To cut text to a maximum length instead of wrapping it, try the Text Truncator.
How it works
Each existing line is handled on its own. If it already fits within the width, it is kept unchanged. Otherwise the tool splits it into words at spaces and fills lines greedily: it keeps adding the next word plus one space while the line stays within the width, and starts a new line when the next word will not fit. The width is measured in visible characters, so emoji are not counted twice.
With the split option on, a word longer than the width is cut into chunks of exactly the width before wrapping continues. Without it, such a word sits on a line of its own and is allowed to be longer. Any indentation at the start of the original line is kept on the first wrapped line. It all runs in your browser.
Worked examples
Email at 30 columns. “Plain text emails often wrap at a fixed width so they read well in any mail program.” at width 30 becomes three lines: “Plain text emails often wrap” (28 characters), “at a fixed width so they read” (29) and “well in any mail program.” (25).
A long link, kept whole. “See https://example.com/a/very/long/path/to/a/page for details” at width 20 puts the link on its own line, 46 characters long, with “See” above and “for details” below.
A long link, split. The same text with the split option on cuts the link into https://example.com/, a/very/long/path/to/ and “a/page for details”. Note that a split link no longer works when clicked.
Limits and tips
- Continuation lines of an indented paragraph start at the left edge; only the first line keeps the indent.
- Runs of spaces inside a wrapped line become single spaces.
Frequently asked questions
What width should I use?
Does it ever break a word in half?
What happens to lines that are already short?
Is width counted in characters or in screen space?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.