Skip to content
AgileLogics

Random CSV Generator

Generates a CSV grid of random 8-character alphanumeric values, for testing imports or layouts.

How it works

Choose the number of rows and columns, then click Generate.

What does the random CSV generator output?

It outputs a comma-separated grid in which every cell is an 8-character string of random letters and digits. You choose 1 to 50 rows and 1 to 10 columns. There's no header row and no quoting, and rows end with a line feed. The point is a file of the right shape for testing an importer, a parser or a table layout, not realistic records.

If you need data that looks like people or products, this isn't that tool. If you need to know whether your upload screen handles 50 rows of 10 columns, it's ideal.

Making a file

  1. Set Rows (1 to 50, default 5).
  2. Set Columns (1 to 10, default 3).
  3. Click Generate.
  4. Click Copy, paste into a text editor and save as test.csv.

A 3-row, 4-column run produced:

NyJDmvu3,f0zMFLeQ,QeMQuKb5,WTyHnKr4
3mquJ9dV,YA93JMQV,GEfI9GYV,jNTfTpPV
QsQxgZFi,gnCuN9qt,2rsGreP0,p6hqPjHO

Every cell draws each of its 8 characters from a 62-character alphabet using crypto.getRandomValues(), the browser's secure random source. Nothing is uploaded; the grid is built on the page.

How the output lines up with RFC 4180

CSV has no single owner, but RFC 4180 is the closest thing to a reference: it documents the common format and registers the text/csv media type. Here's how this generator's output compares:

RFC 4180 rule This output
Records end with CRLF Uses LF only
A header line is optional Never included
Each record has the same number of fields Always true
Fields containing commas, quotes or line breaks must be enclosed in double quotes Never needed; cells are letters and digits only
Spaces are part of a field No spaces are generated

The LF line ending is the only real departure. Excel, Google Sheets, Python's csv module and the major databases all read LF files, so you'll rarely hit it, but a strict validator might complain.

What random alphanumeric cells won't test

A clean grid is the easy case for any CSV parser. The bugs live in the awkward parts of the format, and this output never exercises them:

  • a comma inside a quoted field, such as "Smith, John"
  • an escaped double quote, written as two quotes: "He said ""hi"""
  • a line break inside a quoted field
  • empty fields (a,,c) and a trailing comma
  • non-ASCII text, like Zoë or 東京, and a UTF-8 byte order mark
  • values a spreadsheet will reinterpret, such as 00123 or 1/2

My advice: generate a grid for bulk and shape, then hand-edit three or four rows to add the cases above. An importer that only ever saw random alphanumeric rows hasn't really been tested.

id,name,note
1,"Smith, John","He said ""hi"""
2,Zoë,
3,00123,"line one
line two"

Loading the file into a database

Both big open-source databases can bulk-load the file directly. In PostgreSQL, COPY with FORMAT csv reads it; add HEADER only if you added a header line yourself. In MySQL, LOAD DATA needs the delimiter and line ending spelled out:

-- PostgreSQL
COPY test_rows (a, b, c) FROM '/path/test.csv' WITH (FORMAT csv);

-- MySQL
LOAD DATA INFILE '/path/test.csv' INTO TABLE test_rows
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';

Because each cell has about 47.6 bits of randomness (62 to the power of 8 is roughly 218 trillion values), a column of generated cells also works as a throwaway unique key, which is handy when a test table has a UNIQUE constraint. The SQL lessons cover the table side if you're new to it.

Related generators

The random TSV generator builds the same kind of grid with tabs instead of commas, which pastes straight into spreadsheet cells. For nested test data, the random JSON generator creates an array of sample objects. To preview the grid as a web table, paste it into the HTML table generator.

Last updated

Frequently asked questions

Does the CSV include a header row?
No. Every row is data. If your importer expects column names, type a line such as col1,col2,col3 above the output before saving.
Are the values ever quoted?
Never, because they don't need to be. Each cell uses only A-Z, a-z and 0-9, so no cell contains a comma, double quote or line break, which are the characters RFC 4180 says must trigger quoting.
How do I save the output as a .csv file?
There's no download button. Click Copy, paste into a plain-text editor, and save the file with a .csv extension using UTF-8 encoding.
Which line endings does it use?
Rows end with a line feed (LF) only. RFC 4180 specifies CRLF, but nearly all modern parsers accept either. If a strict tool rejects the file, switch the line-ending setting in your editor to CRLF before saving.
Could two cells come out the same?
It's possible but extremely unlikely. Each cell is one of about 218 trillion possible values, so even a full 50 by 10 grid has less than a one-in-a-billion chance of containing a repeat.