How to Convert a CSV File to Pipe Delimited in Windows

Yes, you can convert a comma-delimited CSV file to pipe delimited in Windows without installing anything. If none of your data contains commas, open the file in Notepad, press Ctrl + H, replace every , with |, and save a copy. If some fields contain commas (addresses, names like “Smith, John”, or prices like 1,200), use the PowerShell or Excel method below so only the separators change.

These steps work in Notepad in Windows 11 and Windows 10, Windows PowerShell 5.1 (built into Windows) and PowerShell 7, and Excel for Microsoft 365 on Windows. The Excel method relies on a Windows setting that Microsoft describes in its guide to importing and exporting text and CSV files.

Which Method Should You Use?

A delimiter is the character that separates one field (column) from the next on each line. In a standard CSV file, that’s a comma. When a field itself contains a comma, the program that created the file wraps that field in double quotation marks, like this:

1001,"Smith, John",Austin

A pipe-delimited version of the same line looks like this:

1001|Smith, John|Austin

That quoted field is why the method matters. A plain find-and-replace changes every comma, including the one inside “Smith, John,” and turns a three-field line into a four-field line. Here’s a quick way to choose:

Your file Best method Why
No commas inside any field Notepad Fastest; nothing to install or configure
Some fields contain commas, quotes, or line breaks PowerShell Reads the CSV properly, so only the separators change
You already work with the data in Excel Excel with a changed list separator Saves directly as pipe delimited, but changes a Windows-wide setting
You don’t have Excel LibreOffice Calc Free, and lets you pick the delimiter when you save

To check whether Notepad is safe for your file, open it in Notepad and press Ctrl + F, then search for a double quotation mark (“). If Notepad finds none, no field contains a comma, and the Notepad method will work.

Convert a CSV to Pipe Delimited With Notepad

Work on a copy so you can go back to the original if something goes wrong. In File Explorer, select the CSV file, press Ctrl + C, then Ctrl + V. Windows creates a file named something like “data – Copy.csv.”

  1. Open the copy in Notepad. Right-click the file, choose Open with, then Notepad. On Windows 11, you may need to click Show more options first, or pick Choose another app if Notepad isn’t listed. The file opens as plain text, with each record on its own line and commas between the fields. There are also other ways to open a CSV file in Notepad.
  2. Press Ctrl + H. The Replace controls open. In Windows 11 Notepad, they appear in a bar at the top of the text with a Find box and a Replace box. In older Notepad, a separate Replace window opens with Find what and Replace with boxes. You can also open it from Edit > Replace.
  3. Type a comma in the Find box. Enter only the comma, with no spaces or quotation marks.
  4. Type a pipe in the Replace box. On a US keyboard, the pipe is Shift + \, the key above Enter.
  5. Click Replace all. Every comma in the file changes to a pipe right away. Scroll through a few lines to check that the fields look right. If something looks wrong, press Ctrl + Z to undo.
Windows 11 Notepad Replace bar with a comma in the Find box and a pipe in the Replace box
Ctrl + H opens Replace. Put a comma in Find, a pipe in Replace, and click Replace all.
  1. Save the file. Press Ctrl + S to keep the current name, or Ctrl + Shift + S to save under a new name. In the Save As window, set Save as type to All files (*.*), type a name ending in the extension you need, such as data-pipe.csv or data-pipe.txt, and leave Encoding on UTF-8 unless the system you’re sending it to asks for something else. Click Save.

If the original file has quotation marks around every field, as some exports do, the pipe file will too (“1001″|”Austin”). Many programs accept that. If yours doesn’t, open Replace again, put “ in the Find box, leave Replace empty, and click Replace all. Do this only if no field contains a comma or quotation mark of its own.

Convert a CSV to Pipe Delimited With PowerShell

PowerShell comes with Windows and understands the CSV format, so it keeps commas that are part of the data and only swaps the separators. It uses Microsoft’s Export-Csv command, which has a -Delimiter option for this exact job.

Your file needs a header row (column names on the first line) for this to work. If it doesn’t have one, use the no-header command in the troubleshooting section.

  1. Copy the file’s location. In File Explorer, right-click the CSV file and choose Copy as path. This copies the full path, in quotes, to your clipboard.
  2. Open PowerShell. Click Start, type PowerShell, and open Windows PowerShell (or Terminal, which opens PowerShell by default on Windows 11). A window with a blinking prompt appears.
  3. Type the command. Enter the line below, replacing both paths with your own. Paste the path you copied in place of the first one, and use a new file name for the second one so you don’t overwrite the original.

Import-Csv -Path "C:\Users\You\Documents\data.csv" -Encoding UTF8 | Export-Csv -Path "C:\Users\You\Documents\data-pipe.csv" -Delimiter '|' -NoTypeInformation -Encoding UTF8

  1. Press Enter. If the command works, PowerShell shows nothing and returns to the prompt. The new file appears in the folder you named.
  2. Open the new file in Notepad to check it. Each line should have pipes between fields. A field like “Smith, John” keeps its comma.
PowerShell command converting a CSV to pipe delimited and the resulting file in Notepad
PowerShell keeps commas inside fields and only changes the separators.

Windows PowerShell 5.1, the version built into Windows, wraps every field in quotation marks (“1001″|”Smith, John”|”Austin”). That’s valid, and most databases and import tools accept it. If you have PowerShell 7 installed, open it instead and add -UseQuotes AsNeeded to the end of the command. PowerShell 7 then quotes a field only when it contains a pipe, a quotation mark, or a line break, which gives you clean output like 1001|Smith, John|Austin.

To check which version you have or get the newest release, follow the steps to update PowerShell on Windows 11.

The -NoTypeInformation part stops Windows PowerShell 5.1 from adding an extra “#TYPE” line at the top of the file. PowerShell 7 leaves that line out by default, so including the option there does no harm.

Convert a CSV to Pipe Delimited With Excel

Excel doesn’t have a “pipe delimited” choice in Save As. Instead, it uses the list separator from your Windows region settings whenever it saves a CSV file. Change that setting to a pipe, save, and change it back.

Before you start: the list separator is a Windows-wide setting. While it’s set to a pipe, other programs that read or write lists can behave differently, and Excel formulas may expect a pipe between arguments instead of a comma. Change it back when you’re done.

  1. Open the Region settings. Press Windows key + R, type intl.cpl, and press Enter. The Region window opens on the Formats tab. (You can also search for Region settings in Windows 11, click Administrative language settings, and switch to the Formats tab.)
  2. Click Additional settings. The Customize Format window opens on the Numbers tab.
  3. Change the List separator. Find the List separator box, which shows a comma for US settings. Replace it with | and click OK, then OK again to close the Region window.
Customize Format window with the List separator box changed to a pipe character
Excel uses this Windows setting as the CSV separator. Change it back to a comma when you’re done.
  1. Open your CSV file in Excel and make any changes you need. If Excel was already open, close and reopen it so it picks up the new setting.
  2. Click File > Save As (or File > Save a Copy if AutoSave is on). Click Browse, set Save as type to CSV (Comma delimited) (*.csv), give the file a new name, and click Save. Despite the name, Excel uses your new separator, so the file is pipe delimited.
  3. Click OK or Yes if Excel warns that only the active sheet will be saved or that some features may be lost. CSV files hold one sheet of plain values, so formatting and extra sheets aren’t kept.
  4. Change the list separator back. Repeat steps 1 to 3 and put a comma back in the List separator box.

Open the saved file in Notepad to confirm it has pipes. If it still has commas, Excel was open before you changed the setting. Close Excel completely and save again.

Keep in mind that opening a CSV in Excel can change your data before you save it. Excel removes leading zeros (ZIP code 02134 becomes 2134), shortens long numbers like account or card numbers, and converts some text to dates. If your file has values like these, the PowerShell method is safer because it never interprets the data.

Convert a CSV to Pipe Delimited With LibreOffice Calc

LibreOffice is a free office suite for Windows, Mac, and Linux. Its spreadsheet app, Calc, lets you choose the delimiter when you save, with no Windows setting to change. The options are described in LibreOffice’s Export Text Files help page.

  1. Open the CSV file in LibreOffice Calc. In the Text Import window, make sure Comma is selected under Separator Options, then click OK.
  2. Click File > Save As.
  3. Set the file type to Text CSV (.csv), enter a new file name, check Edit filter settings, and click Save. If asked, choose Use Text CSV Format!
  4. In the Export Text File window, click in the Field delimiter box, type |, and click OK. Calc saves the sheet with pipes between the fields. With Quote all text cells left unchecked, only fields that contain a pipe get quotation marks.

When Rows Have Too Many Fields

  • Some rows have too many fields after converting. Those rows had commas inside the data, and the Notepad method replaced them too. Start again from your original file and use PowerShell or LibreOffice.
  • PowerShell says the file can’t be found. Check that the path is inside quotation marks and that the file name and extension are spelled correctly. Copy as path avoids typing mistakes.
  • PowerShell says a member or header is already present, or a header is empty. Import-Csv needs a unique name for every column in the first row. Rename duplicate or blank column headers, or treat the file as having no header (next item).
  • Your file has no header row. Use this version, changing the 1,2,3,4 list to match the number of columns in your file:

Import-Csv -Path "C:\Data\data.csv" -Header 1,2,3,4 -Encoding UTF8 | ConvertTo-Csv -Delimiter '|' -NoTypeInformation | Select-Object -Skip 1 | Set-Content -Path "C:\Data\data-pipe.csv" -Encoding UTF8

The Select-Object -Skip 1 part removes the temporary column names, so the output starts with your first data row.

  • Accented letters or symbols look garbled. The file was read or saved with the wrong encoding. In PowerShell, keep -Encoding UTF8 on both commands. In Notepad, choose UTF-8 in the Encoding list when you save.
  • The receiving system rejects the quotation marks. Use PowerShell 7 with -UseQuotes AsNeeded, or LibreOffice with Quote all text cells turned off. If no field contains a pipe or quotation mark, you can also remove the quotes in Notepad as described above.
  • The lines run off the edge of the Notepad window. Turn on word wrap to read long records. The steps for turning on word wrap in Notepad show where the option is.

Pipe Delimited CSV Questions

Can Excel save a pipe-delimited file directly?

Not from a menu option. Excel’s CSV formats use the Windows list separator, so you change that setting to a pipe before saving, as shown above, and then change it back.

Should a pipe-delimited file end in .csv or .txt?

Use whatever the program or person receiving the file asks for. The contents are the same either way. CSV stands for comma-separated values, so many systems expect .txt or .psv for pipe-delimited files, but some import tools only accept .csv.

Why use a pipe instead of a comma?

Commas show up often in real data, like addresses, company names, and numbers, while the pipe character rarely does. Using a pipe as the separator means fewer fields need quotation marks, which makes the file easier for some databases and older systems to read.

How do I convert a pipe-delimited file back to a comma-delimited CSV?

Reverse the same steps. In PowerShell, use -Delimiter ‘|’ on Import-Csv and leave it off Export-Csv. In Notepad, replace | with , as long as no field contains a comma. To combine several converted files afterward, merge CSV files into one file in Windows.