Text Wrapper
Wrap or unwrap text at a custom character width for emails, terminals and code comments. Preserves paragraphs and supports hard or soft wrapping. Free, browser-based.
What is Text Wrapping?
Text wrapping is the process of inserting line breaks into a block of text so that each line does not exceed a specified maximum number of characters. This differs from visual word wrap in your editor — text wrapping inserts hard line breaks (actual newline characters) into the text itself, so the fixed column width is preserved even in applications that do not perform visual wrapping.
The opposite operation — unwrapping — joins hard-wrapped lines back into continuous paragraphs, which is useful when receiving text that was wrapped for a different display width.
Why Wrap Text at a Fixed Column Width?
- Plain text emails — RFC 2822 recommends lines under 78 characters in plain text email. Lines longer than 998 characters violate the SMTP specification. Many mail servers silently truncate or reformat long lines.
- Terminal and command-line tools — Terminals default to 80 columns (the VT100 standard from 1978). Text longer than 80 characters wraps differently depending on the terminal, causing inconsistent display across environments.
- Code comments — Style guides for languages like Python (PEP 8) and Go recommend 79–80 character line limits. Wrapping prose comments to this limit keeps code diffs clean and readable in split-screen editors.
- Version control diffs — GitHub and GitLab display diffs in fixed-width panels. Hard-wrapped text at 80–100 characters makes prose changes much easier to review in a pull request.
- Markdown and plain-text documentation — Hard wrapping at 80 characters is a common convention for README and documentation files committed to repositories.
- Accessibility tools and screen readers — Some assistive technologies and text-to-speech tools handle fixed-width text more predictably.
Common Column Widths
| Width | Use case |
|---|---|
| 72 | Plain text email body (RFC 2822 recommendation) |
| 76 | Base64-encoded email content |
| 79 | Python code comments (PEP 8 standard) |
| 80 | Classic terminal / VT100 standard, most code style guides |
| 100 | Modern wide-screen editors (VS Code default is 80 but many teams use 100) |
| 120 | Widescreen monitors, GitHub PR diff panel width |
How Unwrapping Works
Unwrapping is the reverse operation: it joins consecutive non-blank lines into a single continuous line, removing all hard line breaks that were inserted by wrapping. Blank lines are treated as paragraph separators and preserved intact. This is useful when you receive hard-wrapped text from an old email client, a PDF export, or a document editor and need to reflow it into full paragraphs for editing, reformatting or re-wrapping at a different column width.
Line Prefix Option
The line prefix field adds a string to the beginning of every output line after wrapping. This is useful for converting prose text into code comments in a single step. Enter // to get C/Java/JavaScript-style comments, # for Python/Ruby/shell comments, or * for Javadoc-style block comment lines. The prefix is added after wrapping, so the total line length (prefix + text) may exceed the specified column width.