Add Duplicate Spaces
Add duplicate spaces between words or characters in your text. Double, triple, or multiply spaces with real-time preview and statistics.
About
Text spacing errors cause parsing failures in fixed-width data formats, monospaced terminal layouts, and legacy systems that rely on whitespace-delimited columns. A single missing or extra space in a COBOL copybook or FORTRAN formatted output breaks downstream processing entirely. This tool applies a controlled space multiplication factor n to every whitespace gap in your input, converting each single space into exactly n consecutive space characters (U+0020). It operates on raw Unicode text with no encoding side-effects.
The tool supports four distinct modes: word-gap multiplication (scales existing inter-word spaces), character-level insertion (injects spaces between every glyph), leading/trailing preservation, and tab-to-space expansion before duplication. Note: this tool treats only the standard space character (U+0020). Non-breaking spaces (U+00A0), em-spaces (U+2003), and other Unicode whitespace are passed through unmodified. For inputs exceeding 500,000 characters, consider splitting into chunks to avoid browser memory pressure.
Formulas
The core transformation applies a space multiplication factor to every contiguous run of standard space characters found in the input string.
Where the regex pattern and replacement depend on the selected mode:
Where n = the user-selected multiplier (2 for duplicate, 3 for triple, or any custom integer). For Word Gap Mode, every contiguous block of k spaces becomes k ร n spaces. The total output length L is calculated as:
Where S = total count of original space characters, and Lnon-space = count of all non-space characters (including line breaks).
Reference Data
| Whitespace Character | Unicode | Name | Affected by Tool | Typical Width | Common Use |
|---|---|---|---|---|---|
| U+0020 | Space | Yes | Variable | Standard word separator | |
| U+00A0 | No-Break Space | No | Same as space | Prevents line break | |
| โ | U+2002 | En Space | No | 0.5 em | Typography |
| โ | U+2003 | Em Space | No | 1 em | Typography |
| โ | U+2004 | Three-Per-Em Space | No | 0.33 em | Thin spacing |
| โ | U+2005 | Four-Per-Em Space | No | 0.25 em | Thin spacing |
| โ | U+2006 | Six-Per-Em Space | No | 0.167 em | Fine typography |
| โ | U+2007 | Figure Space | No | Digit width | Tabular number alignment |
| โ | U+2008 | Punctuation Space | No | Period width | After punctuation |
| โ | U+2009 | Thin Space | No | 0.2 em | SI unit separator |
| โ | U+200A | Hair Space | No | Thinnest | Kerning adjustment |
| โฏ | U+202F | Narrow No-Break Space | No | Narrow | French punctuation |
| ใ | U+3000 | Ideographic Space | No | 1 CJK char | CJK text formatting |
| \t | U+0009 | Horizontal Tab | Optional | 4 - 8 spaces | Code indentation |
| \n | U+000A | Line Feed | No | N/A | Line break (Unix) |
| \r\n | U+000D+U+000A | CRLF | No | N/A | Line break (Windows) |