CSV Quotes Remover
Remove unnecessary or all surrounding quotes from CSV data instantly. Paste, upload, or drag-and-drop CSV files for clean, quote-free output.
About
CSV files encoded per RFC 4180 wrap fields in double-quote characters (") whenever the field contains a delimiter, a newline, or the quote character itself. Many downstream systems - flat-file importers, legacy databases, fixed-width loaders - choke on these quotes or interpret them as literal data. Manually stripping them in a text editor risks destroying fields that legitimately contain the delimiter, producing column-shift errors that cascade silently through an entire dataset. This tool implements a character-level state-machine parser that distinguishes structural quotes from literal content, letting you remove only the wrapping quotes while preserving escaped interior quotes and field integrity.
Three removal modes are provided. "Smart" mode removes quotes only from fields that do not require them (no embedded delimiters or newlines). "All surrounding" mode strips every field's outer quotes regardless. "Global" mode deletes every " character - useful only when you are certain no field contains intentional quote characters. The tool auto-detects the delimiter by frequency analysis of the first 5 lines, supporting comma, semicolon, tab, and pipe. Limitations: this tool assumes well-formed CSV. Malformed files with unbalanced quotes will trigger a diagnostic warning with the offending line number.
Formulas
The parser operates as a deterministic finite automaton (DFA) with three states per field:
S1 = INSIDE_QUOTED → if char = Q, transition to S2
S2 = QUOTE_END_OR_ESCAPE → if next char = Q, emit literal quote, return to S1
Where Q is the configured quote character (default "). A field is classified as "quote-necessary" when its content satisfies:
Where D is the detected delimiter character. In "Smart" mode, quotes are preserved when needsQuote returns TRUE. In "All Surrounding" mode, outer quotes are always stripped and interior escaped quotes ("") are reduced to single quotes ("). In "Global" mode, every instance of Q is deleted without field-boundary awareness.
Delimiter auto-detection scores each candidate by counting occurrences across the first 5 lines and selecting the character with the lowest variance in per-line count and a non-zero mean:
Where is the mean occurrence per line and σ is standard deviation. The delimiter with the highest score wins.
Reference Data
| Scenario | Original Field | Smart Mode Output | All Surrounding Output | Global Output |
|---|---|---|---|---|
| Simple text, no special chars | "Hello" | Hello | Hello | Hello |
| Field contains comma | "New York, NY" | "New York, NY" (kept) | New York, NY | New York, NY |
| Field contains escaped quote | "She said ""hi""" | "She said ""hi""" (kept) | She said "hi" | She said hi |
| Numeric field quoted | "12345" | 12345 | 12345 | 12345 |
| Empty quoted field | "" | (empty) | (empty) | (empty) |
| Field with newline | "Line1\nLine2" | "Line1\nLine2" (kept) | Line1\nLine2 | Line1\nLine2 |
| Field with delimiter & quote | "Price is $5, ""final""" | "Price is $5, ""final""" (kept) | Price is $5, "final" | Price is $5, final |
| Unquoted field (no change) | Hello | Hello | Hello | Hello |
| Tab-delimited quoted | "Data" (tab sep) | Data | Data | Data |
| Single-quote (not affected) | "Value" | "Value" | "Value" | "Value" |
| Pipe-delimited with quotes | "A|B" (pipe sep) | "A|B" (kept) | A|B | A|B |
| Semicolon-delimited | "München;Berlin" | "München;Berlin" (kept) | München;Berlin | München;Berlin |
| Mixed: some fields quoted | "A",B,"C,D" | A,B,"C,D" | A,B,C,D | A,B,C,D |
| Whitespace around quotes | "Data" | Data | Data | Data |
| Custom quote char (') | "Hello" | Hello (if configured) | Hello (if configured) | Hello (if configured) |