Skip to content

CSV Validator

Check that pasted CSV rows have the same number of columns. a,b and 1,2 is Valid, with 2 rows and 2 columns. The page does not open a file.

Result

Paste CSV

How to Use

  1. 1 Paste up to 20000 characters.
  2. 2 Choose Check CSV.
  3. 3 a,b followed by 1,2 is Valid.

Example Output

  • a,b 1,2 is 2 rows and 2 columns.

About This Tool

Commas inside double quotes stay in one column. A row with a different column count is rejected.

Using the CSV Validator

The CSV Validator checks that pasted CSV rows have the same number of columns. The CSV field starts as a,b on the first line and 1,2 on the second line. Choose Check CSV. The label above the headline reads CSV. The headline is Valid. The rows line is 2. The columns line is 2. The sentence says 2 rows are valid, with 2 columns. Blank lines are skipped. The page splits each remaining row on commas that sit outside quotes. It does not open a file.

Quotes group a comma inside a column. A quote toggles that grouping and is not kept as a character in the column. In a row such as "a,b",c the comma between a and b stays inside the first column, and c is the second column. That row is Valid, with a rows line of 1 and a columns line of 2. The sentence for that single row says 1 rows are valid, with 2 columns. An opening quote without a closing quote stops the check. The headline then reads Close every quoted column.

A row with a different column count is rejected. a,b followed by 1,2,3 does not stay Valid. The headline reads Each row needs the same number of columns. The rows line and the columns line are cleared, because the check stopped. The sample pair a,b and 1,2 both have two columns, so that paste stays Valid with 2 rows and 2 columns. Check the same paste again and the headline stays Valid.

The width comes from the first non-blank row. a,b sets that width at 2, and 1,2 matches it. The page does not sort the rows or rename the columns. An empty field between commas still counts as a column. a,,b has three columns: a, an empty column, and b. Pair that row with 1,2 and the widths differ, so the headline reads Each row needs the same number of columns. Pair a,,b with 1,,2 and both rows have three columns. The headline can then read Valid, with a rows line of 2 and a columns line of 3. A trailing comma does the same kind of work. a,b, has three columns, not two. The sample a,b has no trailing comma, which is why its columns line is 2.

The field allows from 1 to 20000 characters. An empty field says Enter from 1 to 20000 characters. A paste longer than 20000 characters uses that same message. A paste that is only blank lines says Enter from 1 to 20000 characters, because the trimmed field is empty. The page does not read a path, a spreadsheet name, or a disk file. The characters in the box are the whole input.

Copy result copies the sentence. For the starting paste it copies 2 rows are valid, with 2 columns. Reset returns the field to a,b and 1,2, and the headline to Paste CSV. Copy the sentence before you reset. The same paste always rebuilds Valid, 2 rows, and 2 columns. Change one row so the column counts differ, and the headline becomes Each row needs the same number of columns.

What Valid Means

Valid means every non-blank row has the same number of columns. For a,b followed by 1,2, the headline is Valid, the rows line is 2, and the columns line is 2. The sentence says 2 rows are valid, with 2 columns. The label above the headline reads CSV. The first row contributes the columns a and b. The second row contributes the columns 1 and 2. The page does not treat the first row as a header. Both lines are rows in the count.

A blank line between those two rows is skipped, so the rows line stays 2 and the columns line stays 2. The headline is still Valid. A row that adds a third column changes the outcome. a,b followed by 1,2,3 is not Valid. The headline reads Each row needs the same number of columns. Read the rows line only after the headline says Valid. An error headline means the column counts were not accepted.

How a,b and 1,2 Stay Valid

The page walks the paste line by line. It skips a line that is empty after trimming. It reads commas that are outside quotes as column breaks. a,b has one comma and two columns. 1,2 has one comma and two columns. The widths match, so the headline is Valid. The rows line is 2. The columns line is 2. The steps under the result say to skip blank lines, split each row on commas outside quotes, and require every row to have the same column count. No file is opened while that happens.

The same two lines can become JSON on another page. The CSV to JSON Converter treats the first non-blank row as a header and the later rows as data. a,b followed by 1,2 becomes one object with a set to 1 and b set to 2. Use it when you want that JSON array. Use this page when you want the column check only. This page reports Valid, 2 rows, and 2 columns. It does not build the object.

What the Check Does With Quotes

A quote starts or ends a grouped stretch. Commas inside that stretch stay in the column. The quote characters themselves are not stored in the column text. "a,b",c is one row with two columns: the first is a,b and the second is c. The headline is Valid. The columns line is 2. A comma that should separate columns must sit outside the quotes. If you meant three columns, the quotes are holding the inner comma in place.

An unfinished quote is rejected before a column count is published. The headline reads Close every quoted column. The rows line is not filled in. A quote that opens and closes on the same row is allowed. The page does not apply a second rule for doubled quotes inside a column. It toggles grouping at each quote character. Read the row you pasted if a comma you expected to split a column is still inside one field.

The Starting Paste, a Blank Line, and a Third Column

Leave the field as a,b on the first line and 1,2 on the second line. Choose Check CSV. The headline is Valid. The rows line is 2. The columns line is 2. The sentence says 2 rows are valid, with 2 columns. Check again. The figures match. Put a blank line between the two rows and check again. The headline stays Valid, and the rows line stays 2, because the blank line is skipped. Restore the two-line paste if you want the field to match the starting sample.

A JSON value with extra space is a different cleanup. The JSON Prettifier formats JSON with line breaks and four-space indentation. {"a":1} becomes a readable object that still contains a and 1. That page does not fetch JSON. Use it when the text is JSON and you want it indented. Use this page when the text is CSV and you want every row to share one column count. The prettifier does not report Valid, 2 rows, and 2 columns.

The Character Bound and the Empty Paste

The paste must contain from 1 to 20000 characters. Empty text says Enter from 1 to 20000 characters. Text longer than 20000 characters says the same. A field that trims to nothing uses that message too, so a box of only spaces does not become Valid. The rows line and the columns line stay clear when that message is the headline. The page measures the paste you typed. It does not open a file to find more rows.

A paste that has characters, but every line is skipped, is not the sample. The sample has two non-blank rows. If the only lines are blank, the trimmed field is empty and the message is Enter from 1 to 20000 characters. When at least one row remains and the widths disagree, the message is Each row needs the same number of columns. When a quote stays open, the message is Close every quoted column. Each of those headlines replaces Valid. Count a trailing comma as an extra column before you call a row short. a,b, does not match 1,2. a,b does. The sample sentence belongs to the paste with two columns on each of two rows, and that sentence says 2 rows are valid, with 2 columns.

Rows People Treat as Already Valid

A common miss is to count a,b and 1,2,3 as Valid because both lines contain commas. The first row has 2 columns and the second has 3. The headline reads Each row needs the same number of columns. Another miss is to expect a blank line to count as a row. Blank lines are skipped, so a,b, a blank line, and 1,2 is still 2 rows and 2 columns. Another miss is to leave a quote open and still expect a columns line. The headline reads Close every quoted column. Another miss is to think the page opened a file. No file is opened. The box is the input.

Removing space from JSON is a different pass. The JSON Minifier removes insignificant space from a JSON value. {"a": 1} becomes {"a":1}. The page parses the text first, so a broken value is rejected instead of being trimmed by hand. Use it when the text is JSON and you want the compact form. Use this page when the text is CSV and the question is whether the rows share one column count. {"a":1} is not the sample paste a,b and 1,2.

Valid, a Quoted Comma, and a Mismatched Row

Paste a,b on the first line and 1,2 on the second line. Check CSV. The headline is Valid, the rows line is 2, and the columns line is 2. Add a third line 3,4. Check again. The headline stays Valid, the rows line is 3, and the columns line is 2. Replace the third line with 3,4,5. The headline reads Each row needs the same number of columns. Delete that third line and confirm 2 rows and 2 columns return.

Paste "a,b",c as the only row. The headline is Valid, the rows line is 1, and the columns line is 2, because the quoted comma stays in the first column. Delete the closing quote and check again. The headline reads Close every quoted column. Clear the field and check again. The headline reads Enter from 1 to 20000 characters. Restore a,b and 1,2. Confirm the sentence again says 2 rows are valid, with 2 columns.

Keeping the Sentence With the Paste

Copy the sentence. For the starting paste it says 2 rows are valid, with 2 columns. Write the headline Valid beside it if you also want the short label. A note that says only Valid can be this two-column paste, a one-row quoted paste, or a later run with more rows of the same width. The quoted row "a,b",c is Valid with 1 row and 2 columns, and its sentence says 1 rows are valid, with 2 columns. Keep the sentence that matches the paste you used. The page does not store the run, and it does not open a file to keep it.

Indented markup is a different record. The XML Formatter indents an XML document. <a><b>Hi</b></a> is formatted with each element on its own line. That page does not fetch a file and does not accept a document type. Use it when the text is XML and you want the indentation. Use this page when the text is CSV and you want the shared column count. The formatted elements are not a rows line of 2 and a columns line of 2.

A Column Count From the Rows You Pasted

The headline answers whether the non-blank rows share one column count. a,b followed by 1,2 is Valid, with 2 rows and 2 columns. A blank line does not add a row. A quote groups a comma so it stays inside one column. A row with a different column count is rejected with Each row needs the same number of columns. An open quote is rejected with Close every quoted column. Those outcomes come from the paste. No file is opened.

Checking the Width Before You Trust Valid

Count the commas outside quotes on the first non-blank row, then add one. That is the column count the other rows must match. For a,b the count is 2. For 1,2 the count is 2. The columns line should read 2, and the headline should read Valid. If a later row has a different count, the headline should read Each row needs the same number of columns. If a quote is still open, the headline should read Close every quoted column. An empty field should read Enter from 1 to 20000 characters. The label above a successful headline reads CSV.

Building CSV from JSON objects is the other direction. The JSON to CSV Converter turns a JSON array of objects into CSV. [{"a":1,"b":2}] becomes a header row a,b and a data row 1,2. Download CSV saves that conversion. Use it when you start from JSON objects. Use this page when you already have CSV and you want the shared column count. The converter sample is a header plus a data row. This page counts both of those lines as rows.

Frequently Asked Questions

What do a,b and 1,2 return?

Valid, with 2 rows and 2 columns. The sentence says 2 rows are valid, with 2 columns. The label above the headline reads CSV. The same paste always rebuilds that result. No file is opened.

What happens when a row has a different column count?

The check is rejected. a,b followed by 1,2,3 makes the headline read Each row needs the same number of columns. The rows line and the columns line are cleared. Valid is not shown for that paste.

How do quotes affect a comma?

Quotes group a comma inside a column. The quote marks are not kept in the column. "a,b",c is Valid, with 1 row and 2 columns, and the first column is a,b. A quote that never closes says Close every quoted column.

Are blank lines counted as rows?

No. Blank lines are skipped. a,b, a blank line, and 1,2 is still Valid, with 2 rows and 2 columns. The page still requires every remaining row to share one column count.

Does the first row become a header?

No. Every non-blank line is a row. a,b and 1,2 is 2 rows and 2 columns. The page does not name a or b as headers and does not build a JSON object.

How much text can the field hold?

From 1 to 20000 characters. An empty field, a field that trims to nothing, or a paste past that bound says Enter from 1 to 20000 characters. The page does not open a file to extend the paste.

Does the page open a file?

No. No file is opened. You paste the CSV into the field and choose Check CSV. The headline, the rows line, and the columns line come from that paste.

What does Copy result copy?

It copies the sentence. For the starting paste that sentence is 2 rows are valid, with 2 columns. Reset restores a,b and 1,2 and the headline to Paste CSV, so copy the sentence first if you want to keep it.