Simple online tools for developers, networking, text and conversions.

Text Tools

Swap Columns in CSV Files

Swap two CSV columns by header name or 1-based column number.

Tool

Use this tool to swap the positions of two CSV columns. It is useful for fixing column order, matching import templates, cleaning exports, and reorganizing CSV data without manual editing.

About this tool

Use this tool to swap the positions of two CSV columns. It is useful for fixing column order, matching import templates, cleaning exports, and reorganizing CSV data without manual editing.

Use swap columns in csv files when you need a fast browser-based result without extra setup. It works well for quick checks, one-off tasks, and routine formatting or calculation work.

Learn more

Why use this tool

How to use

  1. Put the first column selector on line one
  2. Put the second column selector on line two
  3. Leave a blank line
  4. Paste the CSV below
  5. Run the tool to swap the two columns

Examples

Example

Input

name
role

name,email,role
John,john@example.com,admin
Anna,anna@example.com,editor

Output

role,email,name
admin,john@example.com,John
editor,anna@example.com,Anna

Useful when the column order needs to be corrected fast.

Example

Input

1
3

id,title,status
1,Book,ok
2,Pen,ok

Output

status,title,id
ok,Book,1
ok,Pen,2

Supports both header-based and index-based selectors.

Common errors

Using a column that does not exist

Fix: Check the CSV header or use valid 1-based positions.

Selecting the same column twice

Fix: Use two different selectors.

Forgetting the blank line before the CSV body

Fix: Put the two selectors first, then a blank line, then the CSV.

FAQ

What does Swap Columns in CSV Files do?

It swaps the positions of two selected CSV columns.

Can I select columns by header name?

Yes. You can use exact header names or 1-based column numbers.

Does it change the field values?

No. It only changes the column order.

What if one of the columns is not found?

The tool returns an error so you can fix the selector.

When is this tool most useful?

It is most useful when CSV columns are in the wrong order for imports, exports, or review.

Use cases

Related tools