By Tim King · Updated
Split Text Into Lines
Comma-Separated Text Into Lines, or Split Every N Characters
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Split Lines works
Use this to split text into lines on any delimiter. Paste a comma-separated list, a space-separated command line, a pipe-delimited record or any other single-line string and get one item per line. Pick the delimiter, or split every N characters for fixed-width data. The split is instant and nothing you paste leaves your browser.
Split text into lines: what it does and why
Splitting is the inverse of joining, and it is the first step of almost every list clean-up: you cannot sort, deduplicate or count items until each one is on its own line. This tool exists so that step never needs a spreadsheet or a scripting language.
Delimiters. The presets cover the usual suspects. Comma for CSV-style values, Space for
words and command-line arguments, Semicolon for European CSV and PATH-style lists, Pipe for
log formats and regex alternations, Tab for a spreadsheet row pasted in. Custom text splits on
whatever string you type — a multi-character separator like -> or , works just as well as
a single character. Note that Space splits on any run of whitespace, so double spaces do not
produce empty items.
Regex. For anything irregular, choose Regex and type a pattern in the custom box. Splitting
on [,;]\s* handles a list where some items are separated by commas and others by semicolons.
Splitting on \d+\. breaks up a numbered list. If the pattern is invalid the output shows the
error instead of silently doing nothing, so you can see what to fix.
Every N characters. Fixed-width data — hex strings, base64, serial numbers, columns from a mainframe report — has no delimiter at all. Set Every N characters and the number of characters and the text is chopped into equal chunks, with the final chunk holding whatever is left. Line breaks in the input are removed first so wrapped hex dumps come out clean.
Empty pieces. Two delimiters in a row produce an empty item. By default those are dropped, which is what you want for a messy hand-typed list. Keep them when the position matters, such as a CSV row where an empty cell is real data.
Trimming. Each piece is trimmed of surrounding whitespace, so a, b, c splits cleanly into
a, b, c rather than leaving leading spaces on the last two. Turn trimming off when the
whitespace is part of the data.
What happens to existing line breaks. For the delimiter modes, existing newlines are kept as separators too, so pasting a multi-line CSV produces every cell on its own line. If you only want to split within lines, join them first with a distinct separator and split on that.
FAQ
How do I turn a comma-separated list into one item per line?
Paste the string, leave Split on set to Comma, and copy the result. Trimming is on by default so the space that usually follows each comma is removed. If some items are wrapped in quotes the quotes are left in place — this is a plain split, not a CSV parser, so use the CSV tools for quoted fields that contain commas.
Can I split on more than one delimiter at once?
Yes, with Regex. A pattern like [,;|] splits on commas, semicolons and pipes wherever they
occur, and \s*[,;]\s* also swallows any whitespace around them. Anything JavaScript's RegExp
accepts works here.
What does "Every N characters" do with the last piece?
It holds whatever remains. Splitting a 10-character string every 3 characters gives three pieces of 3 and one of 1. Line breaks in the input are removed before chopping, so a hex dump that was wrapped at 64 characters is treated as one continuous string.
Why did my double spaces not produce blank lines?
The Space preset splits on runs of whitespace rather than on single space characters, because that is almost always what people mean. To split on exactly one space, choose Custom text and type a single space; then set Empty pieces to Keep to see every gap.
See also: all Lists & Lines tools, Writing & Editing, Markdown & HTML, Ciphers & Alphabets.
Related tools
Bingo Card Generator
Random 75-ball, 90-ball and word bingo cards, up to 50 at a time.
Checklist Formatter
Convert Markdown checklists to Jira or Slack format.
Dice Roller
Roll D6, D20 or any custom die with a fair random generator.
Filename Generator
Safe, consistent file names from plain words, with dates and suffixes.
Random Number Generator
Fair random whole numbers in any range, with or without repeats.