What This Tool Does

This tool takes raw CSV (Comma-Separated Values) text and renders it into an interactive, sortable, and searchable data table. It correctly handles complex quoted fields containing commas or newlines according to RFC 4180.

Inputs Explained

How It Works

The tool uses a robust finite-state-machine parser to step through the CSV text character by character. This ensures escaped quotes (`""`) and delimiters inside quotes are parsed correctly. It then dynamically generates an HTML table and attaches client-side sorting and filtering logic.

Formula / Logic Used

Parse State Machine: if char == '"' toggle inQuote; if char == delim and !inQuote start new field; if char == newline and !inQuote start new row.

CSV Viewer & Formatter

Instantly read, search, and sort CSV data in your browser.


Step-by-Step Example

Raw Input:

Product,Price,Notes
"Widget, Blue",12.99,"Durable ""plastic"" build"
Gadget,9.99,N/A

The viewer correctly parses Widget, Blue as one field, and unescapes ""plastic"" to "plastic" in the table view.

Use Cases

Assumptions and Limitations

⚠ Browser-only, no upload, no storage. Your data never leaves your device.

Frequently Asked Questions

How do I render a CSV as an HTML table?

Easiest path: paste your CSV into our CSV Viewer and click "Export as HTML" — you get a complete <table> block with <thead>, <tbody>, and inline classes you can style with your own CSS. For tiny CSVs you can do it in JavaScript with a quick split on commas, but watch out for quoted fields containing commas — those break naive splitting. Libraries like Papa Parse handle edge cases beautifully. For server-side rendering in PHP or Python, use fgetcsv() or csv.reader() respectively, then loop and build HTML. Always wrap user-uploaded data with proper escaping to avoid XSS attacks.

What is the difference between CSV and TSV files?

Same idea, different separator. CSV uses commas between fields; TSV uses tabs. TSV has one big advantage — tabs almost never appear inside data, so you rarely need quoting or escaping. CSV needs careful handling because commas show up in addresses, names, and free-text fields. Both can use either .csv or .tsv extension; the actual delimiter is what matters. Our CSV Viewer auto-detects the separator (comma, tab, semicolon — common in European exports — and pipe), so paste either format and it'll work. When generating exports yourself, TSV is often the safer choice for data with text fields.

How do I view a CSV with quoted fields and embedded commas?

This is exactly why proper CSV parsers exist. The standard rule: a field containing commas, quotes, or newlines must be wrapped in double quotes, and any internal double quotes are doubled. So Smith, John becomes "Smith, John" in CSV, and She said "hi" becomes "She said ""hi""". Our CSV Viewer uses a full RFC 4180-compliant parser, so quoted fields render correctly with the comma still inside. Don't try to handle this with string.split(",") — you'll spend hours debugging. Use Papa Parse (browser/Node), csv.reader (Python), or fgetcsv (PHP), all of which handle quoting natively.

How do I export a filtered CSV view back to a file?

After filtering rows in our CSV Viewer (via the search box or column-specific filters), click "Export filtered" — only the visible rows are written to the new CSV. Headers always come along. You can also pick which columns to include, in case you want a subset. Useful for slicing a master sheet into team-specific files. The export uses UTF-8 BOM by default so Excel on Windows opens it without garbling Indian language characters. If your data exceeds a few hundred thousand rows, do the filtering server-side or with a Python script — browsers have memory limits.

How do I count rows and columns in a CSV file?

Our CSV Viewer shows the row and column count in the status bar — instantly, even for files with 100K+ rows. Programmatically, in shell: wc -l file.csv gives line count (subtract 1 for the header); for column count, head -1 file.csv | awk -F',' '{print NF}'. In Python, pd.read_csv('file.csv').shape returns (rows, cols) directly. One catch: if your CSV has multi-line quoted fields, line-counting tools mislead you because a single record can span several physical lines. Use a real CSV parser for accuracy. Our tool handles all those edge cases automatically for you.

How do I view CSV data with long columns (text wrapping)?

Toggle "Wrap long cells" in our viewer's settings panel — long text values then wrap inside the cell instead of overflowing or showing an ellipsis. You can also drag column borders to manually resize, or click "Auto-fit" to size every column to its widest visible content. For very long descriptions (product specs, comment fields), an even better view is the row-detail mode: click any row to see all its values stacked vertically with full text visible. Saves the squinting-at-truncated-cells problem most spreadsheet tools have. Toggle row striping in the same panel for easier scanning.

How do I view a CSV in dark mode or with row striping?

In our CSV Viewer's settings panel, toggle "Dark theme" for white-on-dark (easier on eyes during long sessions), and "Striped rows" for alternating row backgrounds — dramatically improves scannability. You can also set a custom accent colour for the active row and headers. The settings are saved to your browser's localStorage, so they persist between visits. For accessibility, the dark theme keeps WCAG AA contrast ratios so text stays readable. If you're projecting CSV data in a meeting, dark theme plus larger row height usually reads better from across a conference room.

Sources and References

Related Calculators

JSON to CSV JSON Diff Base64 Encoder Markdown to HTML Hash Generator Color Picker