Database Row Size Calculator
Turns a CREATE TABLE into a byte-by-byte row cost, then into a table size.
Loading the tool…
How to use this tool
- Paste the CREATE TABLE statement, or load a .sql file with the picker.
- Pick the engine you are actually running — the row header, the alignment rules and the page size all differ between them.
- Set the row count to what you expect the table to hold.
- Select Calculate the row size.
- Read the ROW TOTAL and ROWS PER PAGE lines together — if very few rows fit on a page, moving a large text column to its own table is usually the cheapest fix.
What row size calculator does
Adding up the declared widths of the columns gives a number that is always wrong, usually by a third. A row carries a header before any of your data — twenty-three bytes on PostgreSQL, five on InnoDB, seven on SQL Server. If any column is nullable there is a null bitmap. On PostgreSQL every column is aligned to its own natural boundary, so a boolean sitting between two timestamps costs eight bytes rather than one. And rows are packed into fixed-size pages, so a row that is one byte too large for two-per-page wastes nearly half the file.
This page reads your CREATE TABLE and shows the whole calculation: every column with its width and the padding in front of it, then the header, the null bitmap, the page pointer, the row total, how many rows fit on a page, and what the table comes to at the row count you give. Change the engine and the numbers change, because the overheads genuinely differ. Variable-length columns are estimated at half their declared length by default — that is an assumption, and it is stated on the row rather than hidden in the total.