Staaarter

CSV Validator

Parses CSV and reports RFC 4180 conformance issues: rows whose cell count doesn't match the header (ragged rows), quoted fields that are never closed, and files that mix Windows and Unix line endings. Reports a clear, line-numbered list of issues, or confirms the file is valid. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
validationquality

Overview

Introduction

Not every file that looks like CSV actually parses cleanly. Ragged rows, an unclosed quote, or mixed line endings can all cause silent data loss or crashes downstream. This tool checks for those specific problems and reports them clearly.

Rather than a generic "invalid CSV" message, it lists each individual issue with a line number where possible, so you know exactly what to fix.

What Is CSV Validator?

A CSV conformance checker that looks for three classes of problems: rows whose cell count doesn't match the header, quoted fields that are opened but never closed, and files that mix line-ending styles.

It's read-only: it never modifies your data, only reports what it finds.

How CSV Validator Works

The raw text is first scanned for a mix of \r\n and bare \n line endings before any parsing happens.

The CSV is then parsed with a full RFC 4180-aware state machine; if a quoted field is left open at end-of-input, that's reported immediately. Otherwise every data row's cell count is compared against the header's cell count, and any mismatch is reported by row number.

When To Use CSV Validator

Use it before feeding a CSV file into a strict pipeline or database import, to catch structural problems ahead of time.

It's also useful when a CSV file was hand-edited or concatenated from multiple sources, where line-ending and ragged-row issues are common.

Features

Advantages

  • Reports specific, actionable issues rather than a single pass/fail verdict.
  • Catches three distinct classes of problems in one pass: ragged rows, unclosed quotes, and mixed line endings.
  • Runs entirely client-side, so sensitive data never leaves your browser.

Limitations

  • Row numbers for ragged rows are counted by data row, not raw physical line, since a single row can legitimately span multiple lines when it contains a quoted embedded newline.
  • It only checks structural conformance, not semantic correctness like data types or expected value ranges.

Examples

Detecting a ragged row

Input

id,name,active
1,Ada,true
2,Alan

Output

Row 3 has 2 cell(s), but the header has 3.

The header defines 3 columns, but the second data row only has 2 cells, which the validator flags by row number.

Best Practices & Notes

Best Practices

  • Run the validator before any batch cleanup tool, so you know exactly what's broken before fixing it.
  • If the validator reports mixed line endings, normalize them with the broken CSV fixer before further processing.
  • Treat 'Valid CSV' as a structural, not semantic, guarantee: it doesn't check whether the actual values make sense.

Developer Notes

Ragged-row detection reuses `parseCsvGrid` and compares every row's `.length` against the header's; the unclosed-quote and empty-input cases surface directly from `parseCsvGrid`'s own error object, since the shared parser already tracks quote state and line/column position as it scans.

CSV Validator Use Cases

  • Pre-flight checking a CSV file before a database import
  • Diagnosing why a downstream tool is silently dropping or misaligning columns
  • Auditing a hand-edited or concatenated CSV file for structural problems

Common Mistakes

  • Assuming a file that opens fine in a spreadsheet program is automatically well-formed CSV; spreadsheet apps are often very lenient about ragged rows.
  • Ignoring a mixed-line-ending warning because the file 'looks fine'; some parsers split on \n only and will produce extra blank fields on \r\n lines.

Tips

  • If the validator finds ragged rows, follow up with the incomplete record finder for a focused list, or the incomplete record filler to fix them automatically.
  • An unclosed quoted field is usually a copy-paste that got cut off; the broken CSV fixer can often auto-close it.

References

Frequently Asked Questions