↩️ Word Wrap Tool
Wrap long text at a fixed line width, breaking at word boundaries where possible. Useful for formatting code comments or fitting text into a fixed-width display area.
How to use
- Enter the text you want to wrap.
- Set the maximum characters per line (width).
- Choose whether to force-break words longer than the width — the wrapped result appears automatically.
How the calculation works
This tool splits the text into paragraphs at line breaks, splits each paragraph into words at whitespace, and fills each line with words without exceeding the width you set. It breaks the line as soon as the next word would not fit — a simple approach known as greedy wrapping. With "Force-break long words" on, a word longer than the width is cut into width-sized pieces across several lines. With it off, a long word is kept whole on its own line, so only that line exceeds the width. Turn it off for strings that must not be split, such as URLs. Width is counted in characters, not visual width. Full-width and half-width characters both count as 1, and an emoji counts as 1 and is never split in half.
Worked example
Input The quick brown fox jumps over the lazy dog. This is a sample paragraph used to demonstrate word wrapping at a fixed line width. Width: 40 characters Output The quick brown fox jumps over the lazy dog. This is a sample paragraph used to demonstrate word wrapping at a fixed line width. Every line fits within 40 characters, and no word is split.
Things to be aware of
- Japanese text has no spaces between words, so a whole paragraph counts as one long word. With "Force-break long words" on, it is broken every N characters (punctuation may land at the start of a line).
- Runs of spaces and tabs between words collapse to a single space, and leading indentation is removed.
- Useful for wrapping email text at around 72 characters or fitting text to a fixed-width display.
FAQ
Can I avoid breaking in the middle of a word?
Uncheck "Force-break long words" — any word longer than the specified width will be kept whole on its own line instead of being split.
How are blank lines handled?
Blank lines (paragraph breaks) in the original text are preserved as blank lines in the result.
Does this account for full-width vs half-width characters when counting width?
No, this tool uses simple character counting where every character counts as 1, regardless of its visual width.