Text Wrapper

Wrap long lines at a set width, such as 72 or 80 characters.

0 words · 0 charactersNot uploaded

Hard-wrapping for plain-text formats

Some formats expect lines of a fixed maximum width:

  • Git commit messages: body lines are conventionally wrapped at 72 characters.
  • Plain-text email: RFC 5322 recommends lines of no more than 78 characters.
  • Code comments and docstrings: often 80 or 100 columns, matching linters such as PEP 8 (79 for code, 72 for docstrings and comments).
  • Fixed-width terminals, README files and old systems.

The wrapper breaks lines at spaces so words stay whole. Break long words splits words (or URLs) longer than the width. Keep indentation repeats each line’s leading spaces on its continuation lines, so indented blocks and quoted replies stay aligned.

Wide characters

Chinese, Japanese and Korean characters and most emoji occupy two columns in a monospaced terminal. The wrapper counts them as two, so wrapped CJK text lines up correctly.

To undo hard wrapping, use Remove Line Breaks.

Worked example

Here is what the Text Wrapper returns for its built-in example. Settings used: Break long words: off; Keep indentation: on. Click Try an example in the tool above to load it, then change it as you like.

Input
Plain-text email and git commit messages are traditionally wrapped at 72 characters so they read well in terminals and quoted replies. Code comments are often wrapped at 80 or 100 columns.
Output
Plain-text email and git commit messages are traditionally wrapped at 72
characters so they read well in terminals and quoted replies. Code
comments are often wrapped at 80 or 100 columns.

Related tools: Remove Line Breaks, Line Ending & Tab Converter.

Questions

How do I wrap text at 80 characters?

Set the width to 80. Lines longer than that are broken at the last space before column 80.

What width should a git commit message use?

The common convention is a summary of about 50 characters and body lines wrapped at 72.

Last reviewed · How Textkiln tools work