CSV Validator
Data analysts receive exports from partners that use semicolons in one region and commas in another, and the first sign of trouble is a loaded table where every column sits one position off. ETL engineers hit ragged rows mid-batch — a free-text field containing an unquoted comma shifts every column after it, and the job either fails at row 47,000 or, worse, loads silently wrong.
Paste a CSV or pick a file and this validator auto-detects the delimiter (comma, semicolon, tab, pipe), parses with a quote-aware state machine, and reports every problem with its line number: ragged rows, unclosed quotes, mid-field quote warnings, BOM markers, and empty lines. A stats panel shows header columns, row counts, and consistency, and a preview table renders the first ten data rows so you can confirm the split before importing anywhere.
How the validator parses CSV
Delimiter detection samples the first five non-empty lines and scores each candidate — comma, semicolon, tab, pipe — by counting occurrences outside quoted regions. Consistency across lines carries the most weight: a delimiter that appears the same number of times on every sampled line scores far higher than one whose count varies, because mixed counts usually mean the character also appears inside free-text values rather than as a field separator.
Once a delimiter is chosen, a single-pass state machine walks the text character by character. Inside a quoted field, delimiters and newlines are treated as literal content and do not split fields; a doubled quote ("") inside a quoted field is unescaped to a single quote character. Outside quotes, the chosen delimiter pushes the current field onto the row, and a newline terminates the row. This is the RFC 4180 model that PostgreSQL COPY, pandas read_csv, and BigQuery's CSV loader all implement.
After parsing, the header row defines the expected column count and every data row is compared against it — mismatches become line-numbered errors. A UTF-8 BOM (bytes EF BB BF, written automatically by Excel) is detected via the U+FEFF code point, stripped before parsing, and reported as a warning. Unclosed quotes at EOF and mid-field quote characters round out the issue list, each tagged error or warning with the line number to open in your editor.
Before and after: a broken export
Input — a partner export with an unquoted comma and a ragged row:
id,name,city,notes
1,"Doe, Jane",Paris,vip
2,Bob,Lyon
3,Ana,Madrid,"late, delayed",rush Output — the validation report:
Delimiter: Comma (,) Columns: 4 Data rows: 3 Consistent: no
Line 3: Row has 3 fields but the header defines 4.
Line 4: Row has 5 fields but the header defines 4. Who validates CSVs before import
Data analysts
- Check partner exports for delimiter surprises and ragged rows before loading them into a warehouse table.
- Confirm a spreadsheet save did not introduce an invisible BOM that breaks the first column name on import.
- Preview the first rows to verify quoted fields containing commas split correctly before writing a transformation.
Production
- Gate nightly ingest jobs on a validation step so a malformed export fails fast instead of half-loading a table.
- Validate CSVs uploaded by customers through a form before inserting rows into a relational database.
- Catch unclosed quotes in files generated by custom export scripts before they reach downstream ETL stages.
Workflow
- Paste an export from a colleague and get line-numbered issues in seconds, without installing csvkit or writing a throwaway script.
- Validate files that contain customer or financial data locally — nothing is uploaded from the browser.
- Use the delimiter override when a file mixes conventions across sections, then re-validate before importing.
Common CSV pitfalls
- Unquoted commas in free-text fields. A notes column containing Paris, France without surrounding double quotes adds an extra field on that row, shifting every column after it. The validator reports the exact line and both field counts; wrap the value in quotes at the source or fix it before import.
- Excel's invisible BOM. Every CSV Excel exports starts with bytes that mark the file as UTF-8. Excel strips the mark on load, but pandas, csvkit, and PostgreSQL COPY often do not, so the first header becomes a string with an invisible prefix and exact-match column lookups fail. Re-export without the BOM or strip it in the ingest script.
- Semicolon exports from European locales. Many regions configure spreadsheets to use semicolons because the comma is the decimal separator. Auto-detection handles single-delimiter files, but mixed files (comma in one section, semicolon in another) need the delimiter override and a second validation pass before import.
- Unclosed quotes at end of file. A missing closing double quote leaves the parser inside a quoted field through the last line, merging everything that follows into one giant value. The validator flags this as an error at the line where the quote opened, so you can add the closing character rather than hunting through a multi-megabyte export by eye.
Best practices for CSV hygiene
- 1.Always quote fields that may contain the delimiter, a double quote, or a newline — it costs nothing and prevents the most common column-shift failures.
- 2.Validate at the boundary: run every inbound export through a check like this before it reaches a warehouse or ETL job, so malformed files fail at the edge rather than mid-batch.
- 3.Standardize on comma delimiters and UTF-8 without BOM across your organization, and document the convention so partner exports match by default.
- 4.For multi-gigabyte exports that exceed browser limits, run an equivalent check in a streaming tool (csvkit's csvclean, or a custom pandas script) in the same pipeline stage.
Frequently asked questions
What CSV problems does this validator catch?
It flags ragged rows — lines with more or fewer fields than the header — unclosed double quotes that leave a value open at end of file, quote characters appearing mid-field (which many parsers treat as literal text rather than a quote delimiter), and a UTF-8 byte order mark at the start of the file. Empty lines are reported as warnings because most parsers skip them while strict pipelines reject them. Each issue carries the line number where it was found, so you can jump straight to the broken row in your editor.
How does delimiter auto-detection work?
The validator scores four candidates — comma, semicolon, tab, and pipe — against the first five non-empty lines. For each candidate it counts occurrences outside quoted regions per line, then rewards delimiters whose per-line counts are consistent. A delimiter appearing ten times on every line scores higher than one appearing three times on the first line and eleven on the second. Ties go to the higher first-line count; comma wins if no candidate clears the threshold. You can override auto-detection with the delimiter selector when a file mixes conventions.
Why does my file show a BOM warning even though Excel opens it fine?
Excel writes a UTF-8 byte order mark (the invisible bytes EF BB BF) at the top of every CSV it exports. Excel also removes that mark on load, so you never see it. Many command-line parsers and database importers do not strip it, and the first header arrives as a string starting with the invisible \uFEFF character, which breaks exact-match column lookups. The validator detects the mark, strips it before parsing, and warns you so you can re-export without it or strip it in your ingest script.
What does a ragged row error mean for my import pipeline?
A ragged row has a field count that does not match the header row — the classic cause of shifted columns in a loaded table. If row 47 has three fields where the header defines four, most importers either pad with nulls (silently corrupting downstream joins) or fail the entire batch. The validator reports the exact line and both counts, so you can find the missing or extra delimiter — often an unquoted comma inside a free-text field — and wrap that field in double quotes before importing.
Can I validate large CSV files with this tool?
The validator parses in the browser with a single-pass state machine, so files up to a few megabytes process near-instantly; very large files (tens of megabytes or more) will block the UI thread while parsing and may hit browser memory limits. For multi-gigabyte exports, split the file with head or csplit first, validate a representative sample, or run an equivalent check in a streaming tool like csvkit in CI. The preview shows only the first ten data rows regardless of file size, keeping the result panel responsive.
Does the validator enforce RFC 4180 quoting rules?
It checks the practical subset of RFC 4180 that trips up real pipelines: fields containing the delimiter, double quote, or newline must be wrapped in double quotes, and literal double quotes inside a quoted field are escaped by doubling them. The state machine tracks whether it is inside a quoted field, so delimiters and newlines inside quotes do not split fields. Mid-field quote characters that RFC 4180 would treat as data errors are reported as warnings rather than hard failures, because many real-world files contain them without breaking lenient parsers.
Is my CSV data uploaded anywhere?
No. Parsing and validation run entirely in your browser; the pasted or selected file is never transmitted to a server. That matters for CSVs containing customer records, employee data, or unreleased financial figures that should not leave your machine. Nothing is stored after you close or reload the page.
Related data tools
Generate dialect-aware INSERT statements from validated CSV
Convert validated CSV rows to JSON once the parse is clean
Split large exports into smaller files after validation
Prettify the JSON produced from your CSV rows
Remove sensitive columns before sharing an export
Enforce structure once CSV rows become JSON objects
Compare two versions of an export line by line