Swap Columns

Swap two columns in any delimited text to rearrange your data in seconds.

Swap Columns

This tool swaps two columns in any delimited text: CSV data, tab-separated lists, or pipe-delimited records.
Paste data or type in the "Input" field, set the delimiter & which columns to swap, and press the "Swap Columns" button.
You will instantly get the result in the "Output" field.


Load an example

1. Input Delimiter
2. Swap Columns
3. Output Options
Removes extra spaces around each cell
Ready to swap columns.


Overview

The "Swap Columns" tool is a free online utility that rearranges the order of columns in any delimited text. Whether you are working with comma-separated values, tab-delimited exports, pipe-separated records, or any other delimited format, this tool lets you swap two columns in seconds without retyping anything.

Paste your data into the Input field, pick the delimiter that separates your columns, choose which two columns to swap, and press the "Swap Columns" button. The rearranged text appears in the Output field, ready to copy or download.

The tool runs entirely in your browser. Your data is never uploaded to or stored on any server.


How to Use This Tool

1. Add your text: Paste or type delimited text into the "Input" field, click "Upload a file" to load a text file, or use "Load an example" to try a sample.

2. Set the delimiter: Choose the character that separates your columns from the Input Delimiter dropdown. If your delimiter is not listed, select "Custom..." and type it in the field that appears.

3. Pick the columns: Select which two columns to swap from the "Swap Column" and "with Column" dropdowns. The options update automatically based on the number of columns detected in your input.

4. Set output options (optional): Enable "Trim whitespace" to strip extra spaces around each cell, or change the "Output delimiter" to convert your data to a different format in one step.

5. Swap the columns: Click the "Swap Columns" button. The rearranged text appears in the "Output" field. Copy or download the result, and use "Clear & Reset" to start over.


Examples

Every example loads its own text and settings — click "Try it" to see the result in the Output field right away.

1. Reorder a name list

Swap the surname and first name in a comma-separated list to go from "Last, First" to "First, Last".

Input
Robinson,Kenneth H.
Harris,Martin S.
Walker,Linda A.
Lopez,Sandra K.
Output
Kenneth H.,Robinson
Martin S.,Harris
Linda A.,Walker
Sandra K.,Lopez

2. Reorder CSV columns

Swap column 2 (email) with column 3 (phone) in a pipe-delimited contact list.

Input
Alice|alice@email.com|555-1234|NYC
Bob|bob@email.com|555-5678|LA
Carol|carol@email.com|555-9012|Chicago
Output
Alice|555-1234|alice@email.com|NYC
Bob|555-5678|bob@email.com|LA
Carol|555-9012|carol@email.com|Chicago

3. Swap and convert delimiter

Swap columns 1 and 3 while also converting from semicolon-delimited to comma-delimited output.

Input
Apple;Red;Fruit
Carrot;Orange;Vegetable
Blueberry;Blue;Fruit
Output
Fruit,Red,Apple
Vegetable,Orange,Carrot
Fruit,Blue,Blueberry

Features & Options

Input & Output: Paste or type your delimited text into the "Input" field. After pressing "Swap Columns", the rearranged text appears in the "Output" field, ready to copy or download.

Input Delimiter: Choose the character that separates your columns. Options include comma, tab, semicolon, pipe, and space. Select "Custom..." to type any delimiter you need. For example, swapping columns in "one,two,three" with the delimiter "," swaps the comma-separated fields.

Swap Column with Column: Two dropdowns let you pick which columns to exchange. The options update automatically based on the number of columns detected in your input text. For example, selecting "Swap Column 1 with Column 3" in "A|B|C" produces "C|B|A".

Trim Whitespace (off by default): When enabled, leading and trailing spaces are removed from every cell. For example, " Hello , World " becomes "Hello" and "World" after trimming.

Output Delimiter: By default the output uses the same delimiter as the input. Choose a different option to convert your data format in one step — for example, change a semicolon-delimited list to comma-separated while swapping columns.

Load an Example: Loads a sample text into the Input field with pre-set options so you can try the tool instantly.

Upload a File: Reads a text file from your device into the Input field.

Copy & Download: "Copy" puts the output on your clipboard; "Download" saves it as a text file.

Swap Columns Button: The central action — it rearranges the columns using your selected delimiter, column choices, and output options, and writes the result to the Output field.

Clear & Reset: Clears both textareas and resets all options to their defaults.


FAQs

FAQ 1: What types of delimited text can I use?
Answer: Any text where columns are separated by a consistent character. Common formats include comma-separated values (CSV), tab-separated values (TSV), pipe-delimited data, and semicolon-separated lists. You can also enter a custom delimiter for non-standard separators.

FAQ 2: What happens if some rows have fewer columns than others?
Answer: Rows that do not have enough columns for the swap are padded with empty values so every row in the output has the same number of columns. No data is lost or silently dropped.

FAQ 3: Can I change the output delimiter at the same time as swapping?
Answer: Yes. The "Output delimiter" dropdown lets you pick a different separator for the output. For example, you can convert a pipe-delimited list into a comma-separated one while swapping two columns in a single step.

FAQ 4: How do I swap more than two columns?
Answer: Run the swap multiple times with different column pairs. Each time you swap, the rearranged result appears in the Output field. Paste that output back into the Input field and swap the next pair.

FAQ 5: Does this tool modify my original text?
Answer: No. The "Input" field is never modified by the tool. Only the Output field reflects the column swap and any output options you selected.

FAQ 6: Is my data private?
Answer: Yes. The tool runs entirely in your browser using JavaScript. Your text is never uploaded to or stored on any server.

TextToolz

The Ultimate Text Tools

TextToolz works seamlessly to let you convert and design your text. It is fast, reliable and secure. Trusted by thousands of users.