Friday, November 6, 2026 · Asia/KarachiFree tools · No signup · Runs in your browser

Add Commas Tool

Add Commas turns a list into a single comma-separated line. Paste IDs from a spreadsheet column, words separated by spaces, or city names one per line, and you get "apple, banana, cherry" ready for an email, an SQL IN clause, a tag field or a CSV cell. If your list has one item per line, multi-word items such as "New York" are kept together.

How to use

  1. Paste the list into the box: one item per line, or items separated by spaces on one line.
  2. Press the button to join the items with commas.
  3. Check that multi-word items stayed together. They do when each item is on its own line.
  4. Copy the comma-separated result.
  5. For SQL or code, add quotes around each item first with Add Prefix and Add Suffix.
  6. Remove duplicates beforehand if the list may contain repeats.

Formula / how it works

The tool chooses how to split your text based on whether it contains line breaks:

  • If the text contains a newline, each line is one item. Lines are trimmed of leading and trailing spaces, and empty lines are dropped. So "New York" on one line stays "New York".
  • If the text is a single line, it is split on any run of whitespace (spaces or tabs), so every word becomes an item.

The items are then joined with a comma and a space:

output = items.join(', ')

Why the two modes. Splitting on every space would turn "New York" into "New, York". Column data copied from Excel or Google Sheets arrives one value per line, so line mode is the common case and keeps multi-word values intact. A single line of words, such as tags typed in a chat, is still split word by word.

Blank and spaced lines. Empty lines and lines containing only spaces are skipped, so a column with gaps produces no empty items or double commas. A trailing newline at the end of a pasted column is also ignored.

Existing commas are not removed. If an item already contains a comma, such as "Lahore, Punjab", it stays inside that item and the output will be ambiguous for CSV. Wrap such items in double quotes, or replace the comma before joining.

Separator is fixed. The join string is always ", " (comma plus space). For a semicolon-separated list for European Excel, or comma without a space for some APIs, run a find-and-replace on the result.

Common destinations:

  • SQL: WHERE id IN (1001, 1002, 1003, 1004). Numbers work as-is; text values need quotes.
  • Email: most clients accept addresses separated by ", " in the To field.
  • Tags and keywords: CMS keyword fields and YouTube tags take comma-separated values.
  • Spreadsheet formulas: a quick list for an array constant like {1001, 1002, 1003}.
  • Human-readable lists: "apples, bananas, cherries" for a sentence. Add "and" before the last item yourself if you want an Oxford-comma style list.

Reversing it. To go from comma-separated back to one item per line, use a find-and-replace of ", " with a newline in any text editor.

Large lists. Thousands of items join instantly. Many destinations have their own limits, though: SQL Server allows about 2,100 parameters in an IN list, and Oracle caps literal IN lists at 1,000 items, so split long ID lists into chunks.

Worked examples

Words on one line

Inputs: apple banana cherry

Paste the single line and press the button. There are no newlines, so the text is split on spaces into three items and joined with ", ".

Result: apple, banana, cherry

Word mode: every space starts a new item.

Spreadsheet column of IDs

Inputs: 1001 / 1002 / 1003 / 1004, one per line

Copy four cells from a spreadsheet column and paste. The text contains newlines, so each line becomes one item.

Result: 1001, 1002, 1003, 1004

Ready for WHERE id IN (1001, 1002, 1003, 1004).

Multi-word city names

Inputs: New York / Lahore / San Francisco, one per line with a trailing newline

Paste three cities on separate lines. Line mode keeps New York and San Francisco together, and the empty last line is dropped.

Result: New York, Lahore, San Francisco

On a single line these would split into five items.

Use cases

  • Building an SQL IN clause from a column of IDs.
  • Pasting email addresses into a To or BCC field.
  • Creating tag or keyword lists for a CMS or video platform.
  • Turning a vertical shopping or packing list into one line for a message.
  • Preparing array constants for spreadsheet formulas or code.

Tips & limitations

  • Put one item per line to keep multi-word items together.
  • Quote text values before using them in SQL.
  • Check for commas inside items before using the output as CSV.
  • Split very long ID lists into chunks of 1,000 for databases.
  • Replace ", " with ";" afterwards for semicolon-separated lists.

FAQ

Why did "New York" become "New, York"?

Your text was on a single line, so it was split on spaces. Put each item on its own line and multi-word items stay together.

Are empty lines turned into empty items?

No. Blank lines and lines with only spaces are skipped.

Can I use a different separator?

The tool always uses ", ". Use find-and-replace on the output for semicolons, pipes or commas without spaces.

How do I add quotes around each item?

Run Add Prefix and Add Suffix with a quote character on the one-per-line list first, then join with this tool.

Does it remove duplicates?

No. Remove duplicate lines first if your list may contain repeats.

Is there a size limit?

No fixed limit in the tool. Destinations such as databases and email clients may have their own limits.

Runs entirely in your browser; your text is not uploaded. Counts and scores are heuristics, so review the output before you publish it.