CSV Viewer
CSV Viewer, Sorter & Converter
Your table will appear here. Paste CSV above or open a .csv file.
How to Use the CSV Viewer
Load your CSV
Paste your data into the box, or click Open .csv file to read one from your computer (it is read as UTF-8). The delimiter is detected: comma, semicolon, tab and pipe are each tried on the first 50 rows, and the one that splits the most rows into the same number of fields wins. The line under the buttons says which it chose and why; pick one from the dropdown to override it.
View it as a table
Press View table. Leave "First row is a header" ticked if your top row holds column names; untick it and the columns are named column_1, column_2 and so on. If the file breaks the CSV rules — a quote that never closes, a quote in the middle of an unquoted field, rows with a different number of fields — a yellow list under the status line says what and on which line.
Sort any column
Click a column header to sort by it; click again to reverse. A column marked 123 holds only numbers and sorts by value (9 before 80, and 1,240.00 after 129.00); a column marked abc sorts as text. Empty cells go to the bottom either way.
Convert and export
Choose JSON, SQL, XML or Markdown. Copy the result or download it. For SQL, pick the database first: MySQL and PostgreSQL disagree about backslashes and identifier quotes, and a statement written for one can store the wrong text in the other.
Working With CSV: View, Sort, Convert
Where simple CSV readers go wrong
CSV looks like one line per row and a comma between columns, and a reader that splits on commas works until the first awkward value. RFC 4180, the 2005 IETF memo that finally wrote the format down, says a field may be wrapped in double quotes, and that a quoted field may hold commas, line breaks and quote characters, the last written twice (""). So "Smith, John" is one cell, "Desk Lamp ""Nova""" is the text Desk Lamp "Nova", and a line break inside quotes does not end the row. This viewer reads those rules exactly. It also follows two rules readers often skip: spaces around a value are part of it ("spaces are considered part of a field and should not be ignored"), and a quote may appear only in a quoted field. When a file breaks that second rule, the viewer keeps the character and tells you the line, instead of guessing.
The other common failure is the delimiter. RFC 4180 is comma-only, but spreadsheets in locales that write decimals with a comma usually export with semicolons, and copying cells out of a spreadsheet puts a tab between them. Rather than assume, the viewer tries all four candidates and reports which one it used. Sorting has a similar trap: deciding "is this a number?" one pair of cells at a time is not a consistent order, so the result can depend on the browser. Here the decision is made once per column, and a column sorts numerically only when every non-empty cell in it is a number. Commas inside a number are read as thousands separators, so a file that writes a comma for the decimal point (1,5 for one and a half) sorts that column as text rather than misreading it.
"CSV looks trivial until a value contains a comma. The difference between a toy viewer and a useful one is entirely in how it handles the awkward cases — quotes, escapes, and embedded newlines."
What each export does to your data
JSON is an array of objects keyed by the header, and every value is a string, because CSV carries no types. A header that is blank or repeats an earlier one would silently overwrite a column in JSON, so it is renamed (name_2, column_3) and the rename is listed. SQL is one INSERT per row with empty cells as NULL. For MySQL and MariaDB, names are quoted with backticks and backslashes in values are doubled, because MySQL treats a backslash inside a string as an escape character unless the server runs with NO_BACKSLASH_ESCAPES; without that, C:\new would be stored with a line break in it. For PostgreSQL and SQLite, names take double quotes and backslashes stay as written, which is PostgreSQL's default since version 9.1. XML uses each header as an element name; a header that is not a legal XML name (it has a space, starts with a digit, or starts with "xml") is renamed and listed. Markdown escapes pipes, writes line breaks inside a cell as <br>, and right-aligns the number columns.
Private by design
CSV files are often the most sensitive data an organisation handles: customer lists, transaction exports, staff records. This tool reads the file you open with the browser's own file reader and does every step in this page, with no upload. You can check by loading the page, disconnecting from the network, and using it as before.
What RFC 4180 actually says, and what this viewer does when a file breaks it
RFC 4180 is an Informational memo from October 2005, not a standard. It documents a format already in wide use, so readers and writers still differ.
The RFC is comma-only. Semicolon, tab and pipe files are other dialects; this viewer detects them and says which one it read.
"Spaces are considered part of a field and should not be ignored." The viewer keeps them, so a, b has a second value of b.
Quotes are allowed only in quoted fields. A file with 5" screen breaks the rule; the viewer keeps the quote and names the line.
A quote that is never closed swallows the rest of the file into one cell. The viewer reports the line where it opened.
A UTF-8 byte order mark at the start of a file is removed, so it does not become an invisible first character of your first header and JSON key.
Frequently Asked Questions
- Paste your CSV (or open a file), press "View table", then click the JSON export button. Each row becomes an object keyed by the header row, in the table's current sort order. Every value is a string, because CSV has no types; convert numbers in your own code if you need them. A blank or repeated header is renamed so no column is lost, and the page lists the renames.
- Yes. A field wrapped in double quotes can contain commas, line breaks and quote characters written as two quotes in a row, as RFC 4180 describes. So
"Smith, John"stays one cell. If a quote opens and never closes, or appears in the middle of an unquoted field, the page tells you the line number rather than quietly producing a different table. - Yes, and you normally do not have to say so. With the delimiter on Auto-detect, comma, semicolon, tab and pipe are each tried on the first 50 rows, and the one that gives the most rows with the same number of fields is used. The status line names the delimiter and the reason. If it picks wrongly, for example on a one-column file that happens to contain commas, choose the delimiter yourself.
- Per column. A column sorts by value when every non-empty cell in it is a number: an optional sign, digits (commas allowed as thousands separators), optional decimals, an optional exponent and an optional % sign. Those columns are marked 123. Any other column sorts as text, with numbers inside text compared by value, so "item 9" comes before "item 10". Empty cells go last, and rows that tie keep their order from the file.
- One
INSERT INTOper row, with your headers as the column list, the table name you type, and empty cells asNULL. Pick the database first. For MySQL / MariaDB, names are wrapped in backticks and both single quotes and backslashes inside values are doubled. For PostgreSQL / SQLite, names are wrapped in double quotes and only single quotes are doubled. Every value is written as a quoted string; both databases convert it when the column is numeric. - No. The file you open is read by your browser and parsed by this page. Nothing is sent to a server, stored or logged, and the download button builds the file in your browser. You can use the tool with the network disconnected once the page has loaded.
- Untick "First row is a header" before viewing. Every line is then treated as data and the columns are named
column_1,column_2and so on, which the exports use as JSON keys, SQL columns and XML element names. - There is no fixed cap; the limit is your device's memory. To keep the page responsive the table shows the first 2,000 rows and says how many there are in total. Sorting and every export always use all rows.
Method & sources
How it computes
RFC 4180 reading: quoted fields may hold the delimiter, line breaks and "" for a quote; a quote in an unquoted field, text after a closing quote, an unclosed quote and ragged rows are kept and reported by line; a BOM is removed. Delimiter: , ; TAB | tried on the first 50 rows, most consistent wins. A column sorts as numbers only if every non-empty cell is one.
What this tool implements
- RFC 4180 §2 rules 4-7: spaces are part of a field; quotes only in quoted fields; a quoted field may hold commas, line breaks and quotes, a quote written twice. A break in those rules is reported with its line, never repaired silently.
- Delimiter detection: comma, semicolon, tab and pipe are each tried on the first 50 records outside quotes; the one that splits the most records into the same field count (more than one) wins, ties to that order. The page states the reason.
- Sorting is decided per column (numbers only when every non-empty cell parses: sign, digits with comma thousands separators, decimals, exponent, %), which is a total order; empty cells last; ties stable.
- SQL export: MySQL / MariaDB quotes names with backticks (doubled inside) and doubles backslashes in strings, because backslash is an escape unless NO_BACKSLASH_ESCAPES; PostgreSQL / SQLite quotes names with double quotes and leaves backslashes, standard_conforming_strings being on by default since 9.1.
- XML export: element names checked against the XML 1.0 Name production, names starting "xml" reserved, ":" refused without a namespace; characters outside the Char production become U+FFFD. Every rename is reported.
- Corrected 2026-11-05: quote opening mid-field; BOM on the first header; per-pair sort and 1,240.00 read as 1; MySQL backslashes not doubled; duplicate headers overwriting JSON keys; illegal XML names written as-is.
Sources
- Shafranovich Y. RFC 4180, Common Format and MIME Type for Comma-Separated Values (CSV) Files. IETF; 2005. https://www.rfc-editor.org/rfc/rfc4180.txt
- W3C. Extensible Markup Language (XML) 1.0 (Fifth Edition), 26 November 2008 — productions [2] Char, [4] NameStartChar, [4a] NameChar, [5] Name. https://www.w3.org/TR/xml/
- Oracle. MySQL 8.4 Reference Manual, 11.1.1 String Literals (Table 11.1, NO_BACKSLASH_ESCAPES). https://dev.mysql.com/doc/refman/8.4/en/string-literals.html
- Oracle. MySQL 8.4 Reference Manual, 11.2 Schema Object Names (identifier quoting). https://dev.mysql.com/doc/refman/8.4/en/identifiers.html
- PostgreSQL Global Development Group. PostgreSQL Documentation, 4.1 Lexical Structure (quoted identifiers; standard_conforming_strings). https://www.postgresql.org/docs/current/sql-syntax-lexical.html
What can make this go out of date
- None at runtime. The file is read with the browser's FileReader and every step runs in the page; nothing is uploaded.