Overview
Introduction
Turning space-separated text into a one-item-per-line list makes it easy to sort, filter, or paste into a spreadsheet column.
This tool does that conversion in one step.
What Is Spaces to Newlines?
A converter that replaces every run of one or more spaces with a single newline character.
It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.
How Spaces to Newlines Works
A regex matching one or more consecutive spaces is replaced globally with a newline.
The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.
When To Use Spaces to Newlines
Use it to turn a space-separated list of words or tags into a line-per-item list for further processing, sorting, or pasting into a spreadsheet.
It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.
Often used alongside Newlines to Spaces and Text Splitter.
Features
Advantages
- Collapses multiple consecutive spaces into a single newline rather than producing blank lines.
Limitations
- Only matches literal space characters, not tabs or other whitespace.
Examples
Best Practices & Notes
Best Practices
- Pair with Sort Strings or Remove All Empty Lines afterward for further list cleanup.
Developer Notes
The regex `/ +/g` collapses runs of spaces (not single spaces individually) into one newline each, avoiding blank lines from consecutive spaces.
Spaces to Newlines Use Cases
- Converting a space-separated tag list into one tag per line
- Preparing space-separated values for a spreadsheet paste
- Turning a sentence into one word per line for processing
Common Mistakes
- Expecting tabs to also convert; only literal spaces are matched.
Tips
- Use Newlines to Spaces to reverse this operation.