CSV Encoding and Excel Compatibility
CSV files need consistent character encoding and delimiter conventions or Excel and import tools misread columns and special characters.
Quick answer
Save CSV as UTF-8; add UTF-8 BOM (byte order mark) if Excel on Windows mangles accented characters on double-click open. Use comma delimiter in US locale; semicolon in some European Excel locales. Quote fields containing commas, quotes, or newlines. CSV is not a single rigid standard—document encoding and delimiter for each export.
Overview
CSV looks deceptively simple until accented names, currency symbols, or JSON embedded in cells break after round-tripping through Excel. Spreadsheet apps infer encoding and separators from regional settings—German Excel may expect semicolon delimiters while US tools assume commas. Developers exporting user data for business teams must specify UTF-8, optional BOM for Excel friendliness, RFC 4180-style quoting rules, and consistent line endings (LF vs CRLF). Converting CSV to JSON for pipelines avoids some Excel quirks but shifts responsibility to schema validation and nested field handling instead.
UTF-8 and the Excel BOM issue
UTF-8 encodes international text universally. Excel on Windows often assumes legacy ANSI when opening CSV by double-click, corrupting é, ñ, or currency symbols. Prepending UTF-8 BOM (bytes EF BB BF) signals Unicode to Excel without breaking most Unix tools.
Unix-first pipelines sometimes reject BOM as first-field corruption—generate BOM only for Excel-targeted exports. Document which export profile consumers receive.
Delimiters and regional Excel settings
RFC 4180 style uses comma field separators and double-quote quoting. European locales may use semicolon because comma is decimal separator in UI. Mismatch shifts columns silently—validate header row after import.
Tab-separated values (TSV) reduce comma conflicts in free-text fields but confuse users who rename .tsv to .csv without informing importers.
Quoting, escaping, and embedded newlines
Fields with commas must be wrapped in double quotes; internal quotes escaped by doubling (`""`). Multiline addresses belong in quoted fields—single-line parsers break otherwise.
Leading zeros in ZIP codes and phone numbers require text formatting or quote wrapping so Excel does not strip zeros to numbers. Prefix tab trick deprecated—prefer explicit text column import wizard.
Reliable Excel import workflow
Instead of double-click, use Data → From Text/CSV in Excel to pick UTF-8 encoding and delimiter explicitly. Power Query remembers steps for repeatable reports.
For automated pipelines, skip Excel entirely: convert CSV to JSON programmatically, validate schema, load warehouse. Human review exports get BOM and README with open instructions.
Using JSON conversion to reduce ambiguity
CSV-to-JSON preserves field names as keys, clarifying nested intent when moving to APIs. Reverse JSON-to-CSV for download must flatten arrays and pick column order deliberately.
Large CSV files may choke browser converters—sample first rows in dev tools before full client-side conversion in production UX.
Examples
Name with accent
UTF-8 'José' without BOM may display 'José' in Excel double-click open; UTF-8 BOM file opens correctly.
Address with comma
"123 Main St, Apt 4",Springfield,IL requires quotes so comma in street does not split column.
Common mistakes and edge cases
- Exporting Latin-1 then labeling UTF-8 in documentation.
- Semicolon CSV opened in US Excel without import wizard.
- Unquoted JSON blobs in CSV cells breaking comma structure.
- Stripping leading zeros by opening CSV as numbers not text.
Related resources
- YAML vs JSON ExplainedYAML and JSON both serialize structured data; JSON is stricter and universal for APIs, while YAML favors human-readable config files.
- XML vs JSON for Data ExchangeXML and JSON both represent structured data; JSON is leaner for modern APIs while XML remains in enterprise, document, and legacy integrations.
Related tools
- JSON to CSV Converter ProConvert JSON or NDJSON arrays into CSV with file drop, column reorder, flatten, and Excel BOM.
- Nested JSON to CSV ConverterFlatten nested JSON objects into CSV using dot notation column keys.
- JSON Formatter and ValidatorValidate, pretty-print, and minify JSON with clear parse error messages.
Last reviewed: 2026-05-23