The short answer. Paste your lines into the line joiner, type a separator (default , ), copy the one-line result. In Excel, =TEXTJOIN(", ", TRUE, A1:A100). In Word, Find & Replace ^p with the separator. In Notepad++, switch Replace to Extended mode and replace \r\n or \n with your string. On the command line, paste -sd, file.txt joins all lines with a comma. The choice between them comes down to where the lines already live.
When do you need to join lines into one?
Four common cases cover most of the real-world need:
- SQL
IN()lists. You have a column of IDs, you need(1, 2, 3, ...)for a query. - CSV-style cells. A list of tags or categories that needs to fit into one cell, separated by commas or semicolons.
- HTML / Markdown attributes. Comma-separated class lists, space-separated keywords, slug-style joins.
- Reflowing wrapped text. Pasted from a PDF or email where the lines broke at column 72; you want one paragraph back. (For this case, the line break remover with the "space" replacement is a closer fit than a true join.)
The trick is picking a separator that's not already in your data. If any of your items already contain a comma, ", " as a separator gives you an ambiguous output. Pick a pipe (|), a tab, or a more unusual character when collisions matter.
How do you join lines online, instantly?
Open the line joiner. Paste your list, type a separator in the input box, copy the result.
- Default separator is
", "— the most common case (SQLIN()lists, comma-separated tags). Override with any string:|,;,—, a tab character, your own slug. - Newline as a separator. Type
\nliterally in the box to get a multi-line result back — useful when you're switching between joiners for an intermediate step. - Blanks skipped by default. Empty rows are dropped before joining, so you don't get
", , , "messes. Toggle Skip blanks off to keep them as empty items. - Trim each line by default. Leading and trailing whitespace per line gets removed before joining. Toggle off if your data has meaningful indentation.
- Nothing uploads. The whole join is a single
Array.join()call in the browser. Open DevTools → Network to verify — zero outbound requests carrying your list.
How do you join lines in Excel?
Three good options depending on Excel version and your separator preference.
TEXTJOIN (Excel 2019, 365, 2021).
=TEXTJOIN(", ", TRUE, A1:A100)
First argument is the separator. Second (TRUE) means "skip blanks" — the most common preference. Third is the range. This is by far the cleanest join in modern Excel.
CONCAT (Excel 2019+, no separator).
=CONCAT(A1:A100)
Glues the cells together with nothing between. Useful when your cells already contain their own delimiters or when you want a pure concatenation.
The older & operator for tiny lists:
=A1 & ", " & A2 & ", " & A3
Doesn't scale beyond a handful of cells. For anything larger, TEXTJOIN wins.
To wrap the result in parentheses for a SQL IN() clause, nest it:
="(" & TEXTJOIN(", ", TRUE, A1:A100) & ")"
How do you join lines in Google Sheets?
Identical to modern Excel. TEXTJOIN and JOIN both work:
=TEXTJOIN(", ", TRUE, A1:A100)
=JOIN(", ", A1:A100)
The Sheets-specific JOIN is shorter but doesn't have a blank-skipping argument; TEXTJOIN with TRUE as the second argument is the safer default. For SQL-friendly output:
="(" & TEXTJOIN(", ", TRUE, A1:A100) & ")"
How do you join lines in Microsoft Word?
Word's Find & Replace can collapse a list into one line.
- Press
Ctrl+H. - In Find what, type
^p(paragraph mark) or^l(manual line break, fromShift+Enter) depending on what you have. - In Replace with, type your separator:
,,;,|, whatever you want. - Click Replace All.
Two gotchas: (a) you'll end up with a trailing separator on the last line — clean it up manually. (b) If Track Changes is on, paragraph marks won't replace; turn it off first.
How do you join lines in Notepad++ or VS Code?
Text editors handle joins faster than Word for plain-text input.
Notepad++
- Press
Ctrl+H. - Set Search Mode to Extended.
- In Find what:
\r\n(Windows) or\n(Unix); use Regular expression mode with\r?\nto cover both. - In Replace with, type your separator.
- Click Replace All.
VS Code
- Select all lines (
Ctrl+A). - Press
Ctrl+J(Windows / Linux) orCmd+J(macOS) — this is the built-in Join Lines command. It joins selected lines with a single space. - If you need a different separator, use Find & Replace instead:
Ctrl+H, enable regex, search\r?\n, replace with your string.
How do you join lines on the command line?
Three quick recipes.
paste with a separator — the right tool when one exists:
paste -sd, file.txt
Joins every line in file.txt with a comma. -s means "serial" (concat into one line), -d sets the delimiter. paste only takes a single-character delimiter — for ", " (comma + space) or anything longer, jump to the sed recipe below.
tr for newline-to-anything joins:
tr '\n' ',' < file.txt
Single-character delimiter only.
sed for full-power joins:
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/, /g' file.txt
The cryptic preamble reads the whole file into one buffer first; the substitution then replaces every newline with ", ". Same recipe as the line-break-removal article — same reason needed.
On Windows in PowerShell:
(Get-Content file.txt) -join ", "
Cleaner than the Unix versions, no buffer dance required.
Which method should you use?
| Where the lines already are | Fastest method |
|---|---|
| An Excel column or Google Sheet | =TEXTJOIN(", ", TRUE, range) |
| A Word document | Find & Replace ^p with your separator |
| Open in VS Code, joining with a space | Ctrl+J — built-in |
| Open in Notepad++ or VS Code, custom separator | Extended / regex Find & Replace |
| One-off list pasted from anywhere | Browser tool |
Building a SQL IN() from a column | ="(" & TEXTJOIN(", ", TRUE, A:A) & ")" |
| Scripted / batch / very large list | paste -sd, file.txt or PowerShell -join |
| Sensitive data | Browser tool or command line — never an upload site |
Frequently asked questions
How do I avoid a trailing separator?
Most well-designed tools put separators only between items, not after the last one. The browser tool, TEXTJOIN, paste, and PowerShell's -join all do this correctly. The Word Find & Replace approach is the exception — it replaces every paragraph mark, including the last one, so you'll end up with a trailing comma. Delete it manually.
What if my data already contains commas?
Pick a different separator. Pipes (|), tabs (\t), or unusual characters like — avoid collisions. For SQL or CSV output where commas are expected, you usually need to quote each item first — for example, =TEXTJOIN(", ", TRUE, "'" & A1:A100 & "'") to wrap each value in single quotes.
How do I join lines but keep paragraph breaks?
Treat single newlines and double newlines differently. The line break remover with the Keep paragraphs toggle is the cleanest path — single breaks collapse to your separator, double breaks (blank lines between paragraphs) stay intact. Pure join tools collapse everything; this is closer to "reflow".
Can I join lines into a JSON array?
Yes, but it's two steps. (1) Wrap each line in quotes — use the prefix tool with prefix " and the suffix tool with suffix ". (2) Join with , . (3) Wrap the whole thing in [ ]. Or just write a one-liner in your language of choice — for one-off output the manual approach is usually faster than firing up a script.
What's the fastest way for a 100,000-line list?
Command line or PowerShell -join. Both finish near-instantly because they're working in memory without any UI overhead. Excel's TEXTJOIN can struggle past about 30,000 cells depending on the per-cell length — if the resulting string is too large for a cell (the 32,767-character limit), Excel returns #VALUE!. The browser tool handles large lists fine in principle, but the clipboard paste step becomes the bottleneck above a certain size before the tool does.
Is it safe to paste sensitive lines into an online joiner?
Only if the tool runs entirely in the browser. Open DevTools → Network, paste your list, do a join, and watch for outbound requests. If anything carries your data, the page sent it to a server. The joinlines joiner makes zero requests after page load — verifiable in DevTools.
— the joinlines team, 2026-04-15