Calculates on this device. File exports run online.
Database Row Size Calculator
List the columns of a table, or paste its CREATE TABLE statement, and see how many bytes a row takes. For MySQL and MariaDB you get the count toward the 65,535-byte row limit, the largest record InnoDB must keep in a page (the cause of “Row size too large (> 8126)”) and the average record. For PostgreSQL you get the row laid out column by column, with the alignment padding and the number of rows in an 8 KB page.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose Work out the row size.
Your result
How it was worked out
How to use it
- Choose the database. Type each column with its type and length, or paste a CREATE TABLE statement and press Read the columns.
- For MySQL, type the average bytes of long text columns if you know them (AVG(LENGTH(column))); for PostgreSQL, the bytes of a typical value of each text column.
- Press Work out the row size. Add the number of rows to see the size of the whole table.
- To measure your real data, export the table as CSV with a header row and use the box below: every row is measured.
How it is worked out
- MySQL: the bytes of each type come from the MySQL 8.4 Reference Manual (13.7). The 65,535-byte limit counts the largest value of each column with its length bytes; TEXT, BLOB and JSON count 9 to 12 bytes; each nullable column one bit.
- InnoDB (DYNAMIC and COMPACT): a 5-byte record header, the NULL bits, 1 or 2 length bytes for each variable-length value, a 6-byte transaction id and a 7-byte roll pointer, and a 6-byte row id without a primary key (17.10). Long values can go off-page: DYNAMIC keeps a 20-byte pointer, COMPACT the first 768 bytes and the pointer.
- PostgreSQL: a 23-byte row header and a null bitmap, data from a multiple of 8, each value aligned by its type, a 1-byte length header for variable-length values shorter than 127 bytes and a 4-byte header otherwise, and 4 bytes of item identifier for each row in the page (PostgreSQL 17 documentation, 73.2 and 73.6).
Limits
- The page limit of InnoDB is exact here only for 16 KB pages (8,126 bytes); for other page sizes it is “slightly less than half a page”.
- Indexes, page headers, free space in pages and PostgreSQL TOAST compression are not counted. JSON and BLOB sizes are estimates.