UTILS.
Private by default
↩

Word Wrap

Hard-wrap text to a fixed line width using greedy word wrapping.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →
— output appears here —

About this tool

Reflow text so each line fits within a chosen column width, optionally breaking long words. It runs fully in your browser.

Width counts JavaScript string length per line, so an emoji counts as two. It defaults to 80, and an empty, zero or negative value is treated as 1. Text is split at existing line breaks and each line is wrapped separately, so blank lines survive. Breaks happen only at single spaces, not tabs.

With break long words off, a longer word stays on its own line and runs past the limit. With it on, the word fills the rest of the current line and is then cut into full-width pieces, without hyphens. Repeated spaces inside a line are kept, but spaces at the start of a line are dropped. The output box may fold lines on screen in a narrow window, but the copied text keeps your breaks.

Frequently asked questions

How is the text wrapped?
A greedy algorithm fits as many words as possible on each line before moving to the next, preserving existing line breaks.
What does break long words do?
When enabled, words longer than the width are split so no line ever exceeds the column limit.
Does it add a hyphen when it splits a long word?
No. The word is cut at the width and the next piece starts on a new line.
Is indentation preserved?
Yes. Leading spaces on a line are kept as an indent, and the rest of that line wraps within the remaining width. Spaces left at the end of a wrapped line are removed.

More tools