Convert PSV to CSV Online: What Changes, What Can Break, and When to Do It Locally
How PSV to CSV conversion works, why simple find-and-replace corrupts data, what to check in the output, and when an online converter is the wrong choice.
PSV (pipe-separated values) and CSV (comma-separated values) both store a table as plain text, one record per line. Converting between them looks like it only means swapping one character for another. It does not. This review explains what a correct conversion changes, where online converters and quick shortcuts tend to fail, and how to decide whether the result will hold up in the program or system where you plan to use it.
Scope note: no specific online converter was tested for this article, and no tool-specific measurements, limits or privacy terms were available. The guidance below rests on how the two formats work in general, and it tells you what to verify yourself.
Is converting PSV to CSV right for your use?
Conversion is worthwhile when the destination expects CSV. Spreadsheet imports, many database loaders, analytics tools and data-exchange forms all accept comma-delimited files more readily than pipe-delimited ones. The main benefit is compatibility. The decisive tradeoff is that commas are far more common inside real data than pipes. A correct CSV file therefore has to add quoting rules that the original PSV may never have needed. If the converter applies those rules properly, the data's meaning is preserved. If it does not, columns shift silently.
A bounded recommendation: convert with a tool that parses the PSV and then writes CSV with proper quoting. Avoid tools that only replace characters. Use an online converter only for data you would be comfortable uploading to a third party, and verify the output before relying on it.
Keeping the file as PSV, or re-exporting it, is preferable in these situations:
- The destination already accepts a custom delimiter. Many import dialogs let you specify a pipe, which avoids conversion entirely.
- The data came from a database or reporting system that can export CSV directly. A fresh export from the source is usually more reliable than converting a copy.
- The file contains confidential, personal or regulated data, and you cannot confirm how the online service handles uploads.
- The PSV uses an escaping convention you cannot identify, such as backslash-escaped pipes. A generic converter may misread it.
What the conversion actually changes
This is a change to the stored characters, not to how the text is displayed. The output file contains different bytes from the input. A correct conversion changes three things:
- Delimiters: every pipe that separates fields becomes a comma.
- Quoting: any field containing a comma, a double quote or a line break is wrapped in double quotes, as described in the widely used CSV specification, RFC 4180.
- Escaping: double quotes inside a quoted field are doubled, so a single quote character becomes two.
The field values themselves should not change. The words, numbers, order of columns and order of rows should match the original. The term "convert" here has nothing to do with reversing, mirroring or restyling text; it only concerns how field boundaries are marked.
PSV has no single formal standard, which is where most problems start. Some PSV files quote fields the way CSV does. Some escape a literal pipe with a backslash. Some have no escaping at all and simply assume pipes never appear in the data. Database and command-line tools sometimes produce pipe-bordered output with leading and trailing pipes and spaces added for alignment. A converter has to guess which of these it is reading, and the guess can be wrong.
Why find-and-replace is not a conversion
Consider this PSV input:
id|name|note
1|Acme, Inc.|Ships "fragile" items
2|Beta|
Replacing every pipe with a comma produces the following. The second line now reads as four fields instead of three, because the comma in "Acme, Inc." has become a delimiter:
id,name,note
1,Acme, Inc.,Ships "fragile" items
2,Beta,
A parser-based conversion produces the following. The comma-containing field is quoted, the embedded quotes are doubled, and the empty last field on row 2 is kept as an empty value:
id,name,note
1,"Acme, Inc.","Ships ""fragile"" items"
2,Beta,
The second output looks less tidy to a human reader, but it is the one that keeps three columns on every row when a spreadsheet or database reads it.
Will the result stay readable and usable after you copy or share it?
The CSV file itself is plain text and survives copying, emailing and version control without loss. Problems usually appear later, when another program opens or interprets the file. Watch for these points:
- Spreadsheet auto-formatting: when you open a CSV directly, spreadsheet programs may strip leading zeros (as in ZIP codes or account numbers), turn long numbers into scientific notation, or reinterpret text as dates. The converter did not cause this, but the data you see may no longer match the file. Using the program's import feature and marking such columns as text avoids it.
- Character encoding: non-English characters can display incorrectly if the converter and the opening program disagree about encoding. UTF-8 is the safest choice. Some spreadsheet programs only detect UTF-8 reliably when the file starts with a byte-order mark, so check accented or non-Latin text after opening.
- Regional settings: in some locales, spreadsheet software expects semicolons rather than commas in CSV files. This matters less for US settings, but it can affect colleagues who open the file elsewhere.
- Line breaks inside fields: a correctly quoted field can contain a line break. Tools that read CSV one line at a time, such as some command-line utilities, may split that record in two.
- Formula injection: a field beginning with =, +, - or @ may be treated as a formula when the CSV is opened in a spreadsheet. If the data comes from untrusted sources, check for this before sharing the file.
Reading order and accessibility do not change during conversion. Rows and columns stay in the same sequence, and when the file is opened in a spreadsheet, assistive technology reads it as an ordinary grid of cells. Read as raw text, however, both PSV and CSV are hard to follow, and heavy quoting makes CSV harder still. If people rather than programs will read the data, share it as a formatted table or spreadsheet, not as raw CSV. No assistive-technology testing was performed for this article.
Online converter or local conversion?
| Approach | Main benefit | Main risk | Best for |
| Online converter | No installation; fast for one-off files | Upload of data to an unknown service; unknown handling of quotes and escapes | Non-sensitive, small files you can verify |
| Spreadsheet import with pipe delimiter, then save as CSV | Familiar interface; you can set column types during import | Auto-formatting can alter values before saving | Small to medium files with simple data |
| Script using a CSV library | Full control over parsing, quoting and encoding; data stays on your machine | Requires basic scripting | Sensitive, large or recurring conversions |
Do not infer how an online service stores, logs or deletes uploaded files from its design or marketing wording. Unless its published terms state this clearly and you trust them, treat anything you upload as potentially retained.
For local conversion, Python's standard library handles quoting and escaping correctly. This minimal script reads a pipe-delimited file and writes a standard CSV:
import csv
with open("input.psv", newline="", encoding="utf-8") as src, \
open("output.csv", "w", newline="", encoding="utf-8") as dst:
reader = csv.reader(src, delimiter="|")
writer = csv.writer(dst)
for row in reader:
writer.writerow(row)
This script assumes the PSV uses double quotes for quoting, if it quotes at all. If your file escapes pipes with backslashes, or adds padding spaces around values, the reader settings need adjusting. Those spaces would otherwise remain part of each value.
How to check the output before you rely on it
- Count rows: the CSV should have the same number of records as the PSV. Line counts can differ when fields contain line breaks.
- Check column consistency: every row should have the same number of fields as the header.
- Spot-check difficult fields: find values that contain commas, quotes, pipes or line breaks, and confirm they appear intact as single cells.
- Check identifiers and codes: confirm that leading zeros and long numbers survived, ideally by viewing the file in a text editor rather than a spreadsheet.
- Check special characters: confirm that accented letters, symbols and non-Latin text display correctly.
- Check the edges of each row: make sure leading or trailing pipes did not create empty extra columns.
Bottom line
Converting PSV to CSV online is suitable when the data is not sensitive, the converter parses fields instead of replacing characters, and you verify column counts and tricky values afterward. If the destination accepts pipe-delimited files, if the source can export CSV directly, or if the data must stay private, skip the online step: keep the original format, re-export it, or convert locally.