Break Line by Characters
Break long text into lines by character limit with hard or word-aware soft wrapping. Copy or download results instantly.
About
Automated line breaking at a fixed character width is a fundamental operation in text processing, used in code formatting, SMS segmentation, subtitle timing, and legacy system integration where field widths are rigid. Getting it wrong introduces orphaned words, mid-word splits in user-facing content, or silent data truncation in fixed-width database columns. This tool splits input text at a configurable character limit L using either a hard break (exact slice at position L) or a soft break that scans backward to the nearest whitespace boundary to preserve whole words. It handles edge cases: single words exceeding the limit are force-split, existing newlines are respected, and trailing whitespace is trimmed per line. The output is not approximated - each line is guaranteed to be β€ L characters.
Formulas
The hard break algorithm partitions a string S of length n into segments of at most L characters:
The total number of lines produced:
The soft (word-aware) break modifies this by scanning backward from position i β L to find the last whitespace character. Let j be that index. If j > start of current segment, break at j. Otherwise, fall back to hard break at L (forced split for words longer than the limit).
Where S is the input string, L is the character limit per line, n = length of S, i is the line index, j is the backward-scanned whitespace position, and start is the starting index of the current segment.
Reference Data
| Context | Typical Char Limit | Break Mode | Notes |
|---|---|---|---|
| SMS (GSM 7-bit) | 160 | Hard | Multipart splits at exact boundary |
| SMS (Unicode/UCS-2) | 70 | Hard | Emoji & non-Latin text |
| Twitter / X post | 280 | Soft | Character count includes spaces |
| Terminal width (standard) | 80 | Soft | POSIX tradition since VT100 |
| Terminal width (wide) | 120 | Soft | Modern widescreen terminals |
| Email body (RFC 5322) | 78 | Soft | SHOULD limit; 998 MUST limit |
| Git commit subject | 50 | Soft | Convention, not enforced |
| Git commit body | 72 | Soft | Wraps cleanly in git log |
| Subtitle (SRT/VTT) | 42 | Soft | Per line, max 2 lines per cue |
| COBOL record | 80 | Hard | Fixed-width card format |
| Mainframe fixed field | 132 | Hard | Line printer width |
| PEP 8 (Python) | 79 | Soft | Max line length recommendation |
| Google Java Style | 100 | Soft | Column limit |
| Markdown readability | 80 | Soft | Common convention |
| Facebook post preview | 477 | Soft | Before βSee moreβ truncation |
| Instagram caption | 2200 | Soft | Full limit; preview ~125 |
| Push notification (iOS) | 178 | Hard | Lock screen display limit |
| Push notification (Android) | 240 | Hard | Varies by launcher |
| Meta title (SEO) | 60 | Soft | Google truncates beyond this |
| Meta description (SEO) | 160 | Soft | Optimal snippet length |