The quick answer
Paste CREATE TABLE statements, click Generate diagram, and each table renders as an entity box with its columns and types, primary keys marked with a key icon, and a curved arrow from every inline foreign key to the table it references. Download the result as SVG. Parsing and rendering run in your browser; the schema never uploads.
A schema you can finally see
Every inherited database comes with the same archaeology kit: a migrations folder, half a wiki page, and the phone number of the one engineer who remembers why user_events_backup_v2 exists. Reading forty CREATE TABLE statements and holding the graph in your head works for about five tables; somewhere around table twelve, the mental model starts lying to you.
An entity-relationship diagram is the antidote, and the reason nobody has one is that drawing it by hand is miserable: an hour of dragging boxes in a diagram tool, aligning relationship lines, and updating it exactly once before it rots. The generator here takes the other path. The DDL already encodes the structure, so paste the CREATE TABLE statements, click the button, and the diagram draws itself: entity boxes with columns, key marks on primary keys, arrows on foreign keys, and an SVG download at the end.
The update problem also disappears: when the schema changes, paste the fresh DDL and regenerate, and the SVG you commit next to the schema diffs when the DDL does. A diagram that costs four seconds to rebuild is a diagram that stays current.
From DDL text to boxes and lines
The tool occupies the space between a database client and a drawing program, and it connects to nothing. It reads the text you paste, the same text a migration file or a schema-only dump would hand you, which keeps it usable for students writing DDL by hand and keeps production schemas completely offline.
Each table becomes an entity box: a dark header strip carrying the table name in bold white, then one row per column at 22 pixels each inside a 240-pixel-wide box. The column name sits left, the type sits right-aligned and uppercased, and key columns are bold with a key icon in front of the name. A foreign-key column shows its target as a suffix, so customer_id reads customer_id →customers. Boxes lay out on a grid, as many per row as the rounded-up square root of the table count, in declaration order.
Relationships render as curved lines between the boxes: an open circle marks the foreign-key end, a filled circle marks the referenced table, and the caption under the diagram says exactly that, that arrows run from foreign keys to the referenced table. The diagram is a rendered picture, not an editing canvas: you cannot drag boxes, and the one export is the SVG download button.
Generating your first diagram
The input box opens pre-filled with a two-table example, so you can press the button before typing anything. The full flow is four moves.
CREATE TABLE customers (
id SERIAL PRIMARY KEY,
email VARCHAR(255) NOT NULL
);
CREATE TABLE orders (
id SERIAL PRIMARY KEY,
customer_id INTEGER REFERENCES customers(id),
total NUMERIC(10,2)
);Paste the DDL
Paste your CREATE TABLE statements over the example. Only CREATE TABLE statements are read; INSERTs, indexes and other statements are ignored. One column per line is the convention the parser expects, and every migration file writes it that way already.
Click Generate diagram
Unlike the fleet's live-recompute tools, this one is click-triggered: the button parses the DDL, lays out the boxes and draws the arrows below it. If no CREATE TABLE statement is found, an amber bar says exactly that, and nothing else happens.
Read the boxes and arrows
Check the key icons against your primary keys, follow each arrow from a foreign-key column to the table it references, and scan the types on the right of each row. The junction-table caveat below tells you what a composite key will and will not show.
Download the SVG
The download button saves the diagram as er-diagram.svg, which opens in any browser and embeds in documentation. Exports capture the generated layout exactly; nothing on screen is editable.
How the parser reads your CREATE TABLE statements
The parser is small and literal, which is why its behavior is documentable in twelve lines:
match statements: CREATE TABLE name ( body );
split each body: on a comma followed by a newline
skip fragments starting: PRIMARY, FOREIGN, UNIQUE,
CONSTRAINT, CHECK, KEY
for each column line:
first token -> column name
next token -> type (size included), uppercased
remaining text -> flags: NOT NULL, DEFAULT,
REFERENCES t(c)
inline PRIMARY KEY -> column marked as a key column
PRIMARY KEY (col) at table level -> that column marked
inline REFERENCES t(c) -> arrow drawn to table tThe comma-and-newline rule is stricter than it sounds and more forgiving where it matters. A DEFAULT like 'Smith, John' survives because its comma is not followed by a newline, and a DECIMAL(10,2) survives because its comma sits inside the type token. A table written entirely on one line will not split into columns at all, and a comment line inside a body is skipped silently because it does not look like a column. Quoted and backticked identifiers survive the name match.
Two consequences follow from the skip list. A table-level FOREIGN KEY (customer_id) REFERENCES customers(id) line starts with FOREIGN, so the parser drops it and draws no arrow: foreign keys must be written inline on the column to appear. And a table-level PRIMARY KEY (a, b) marks nothing, because the key-marking pass matches single-column keys only; write keys inline, or mark one column, and the composite case is the documented gap.
A four-table schema, end to end
Here is a small order-processing schema written the way a Postgres migration might actually write it: identity columns, a natural-key product table, and a junction table with a composite primary key.
CREATE TABLE customers (
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
full_name VARCHAR(120) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE orders (
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
customer_id BIGINT NOT NULL REFERENCES customers(id),
status VARCHAR(20) NOT NULL DEFAULT 'new',
total_cents INTEGER NOT NULL,
placed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE products (
sku VARCHAR(40) PRIMARY KEY,
title VARCHAR(200) NOT NULL,
price_cents INTEGER NOT NULL
);
CREATE TABLE order_items (
order_id BIGINT NOT NULL REFERENCES orders(id),
product_sku VARCHAR(40) NOT NULL REFERENCES products(sku),
quantity SMALLINT NOT NULL CHECK (quantity > 0),
PRIMARY KEY (order_id, product_sku)
);Input
4 CREATE TABLE statements, 15 columns, 3 inline REFERENCES clauses, 1 table-level composite PRIMARY KEY
Output
4 entity boxes, 3 foreign-key arrows, 3 key-marked columns, 15 column rows
The grid holds two boxes per row: customers with its id marked as a key column beside email, full_name and created_at; orders with its id marked and customer_id carrying an arrow to customers; products with sku marked; and order_items with arrows from order_id to orders and from product_sku to products. The UNIQUE on customers.email draws no mark, because the parser tracks keys and references only. And the junction table's PRIMARY KEY (order_id, product_sku) line marks nothing, the single-column limitation above at work; both columns still render with their types and arrows, just without the key icon.
Four tables is a classroom example; the value shows up when the paste is forty tables and the same fifteen seconds buys you the whole picture without getting tired.
When the DDL hides things from you
A generator is only as honest as its input, and real schemas withhold information in well-documented ways. The list below names each case and what this tool does about it.
- Table-level foreign keys draw no arrow: the FOREIGN KEY (col) REFERENCES line sits on the parser's skip list; write the clause inline on the column to see the edge.
- No foreign keys at all: legacy MySQL built on MyISAM enforced nothing, so the DDL carries zero REFERENCES clauses and the boxes render unconnected. Naming-convention inference is not offered here; an arrow always corresponds to a real constraint.
- Composite table-level keys are unmarked: PRIMARY KEY (a, b) matches the single-column marking pass only, so junction-table columns render without the key icon.
- Polymorphic associations never become edges: commentable_type plus commentable_id point at different tables per row, which no constraint can express.
- Only CREATE TABLE is parsed: views, materialized views and sequences do not exist for this tool, and their lineage lives in the view definition, not the schema.
- Cardinality is not read: UNIQUE and NOT NULL are not tracked, so a one-to-one and a one-to-many render as the same arrow.
Drawing options, compared without mercy
| Approach | Setup cost | Stays in sync with DDL | Schema privacy | Learning curve |
|---|---|---|---|---|
| This generator | Paste DDL, click once | Yes; regenerate on demand | Full, nothing uploaded | None |
| dbdiagram.io | Account, learn their DBML, retype schema | Manual re-entry | Cloud-stored by default | Low but real |
| drawSQL / erdgo | Account, then click-and-drag | Manual | Cloud-stored | Medium |
| MySQL Workbench / pgAdmin reverse-engineering | Connect to the live DB | Refresh from source | Requires DB access from your machine | High; a full IDE |
| Whiteboard or draw.io | Hours of aligning boxes | Never | Yours | High tedium, low skill |
The dedicated diagram platforms are pleasant once the schema is already drawn; their weakness is the import tax, because typing a 40-table schema into a web editor by hand costs an afternoon and starts out stale. The database clients solve sync by connecting directly to production, which is exactly the privilege an auditor or a student does not have. Paste-and-render occupies the useful corner: no account, no connection, no transcription, at the cost of not being an interactive design surface. For documenting what exists rather than designing what does not, that trade is a bargain.
The schema stays on your machine
Offline operation follows for free: air-gapped machines, customer environments with no outbound internet, and airplanes all still get diagrams, because the generator itself makes no network request at all. The SVG export is plain text, so it commits and diffs in your repository alongside the schema.
You can watch the claim hold: open the page with the network inspector visible, paste a schema, and generate. No request leaves the tab while the boxes appear.
Frequently asked questions
These are the questions people actually ask about ER diagram generation, answered directly. If yours is missing, the contact page takes requests.
Can it infer relationships when there are no FOREIGN KEY constraints?
No. Arrows come only from inline REFERENCES clauses on a column, so a column named customer_id with no REFERENCES draws nothing. The parser never guesses from naming conventions, which means an edge on the diagram always corresponds to a constraint in the DDL.
What can I download?
One thing: the diagram as an SVG file named er-diagram.svg. It opens in any browser, drops into docs and slides, and being plain text it commits and diffs next to the schema. There is no PNG export and no other format.
How many tables can one diagram hold?
The parser has no fixed ceiling; it reads whatever CREATE TABLE statements you paste. Layout is the real constraint: entity diagrams stay readable up to roughly 40-60 tables, past which any tool's output turns into spaghetti. For bigger schemas, render subsets by pasting only the tables of one domain at a time.
Does it show one-to-one versus one-to-many relationships?
No. Every relationship renders as the same arrow, a curved line with an open circle at the foreign-key end and a filled circle at the referenced table. Cardinality would require tracking UNIQUE and NOT NULL constraints, which the parser does not do; the reading is yours to supply from the DDL.
Are my table definitions uploaded to a server?
No. Parsing, layout and rendering all run in the browser tab. Schema definitions describe the shape of internal systems, and table names alone can be sensitive, so this tool was built with no upload path at all.
Sources and further reading
The parser's grammar comes straight from the CREATE TABLE references below, and the arrow convention mirrors the parent-child language in SQLite's foreign-key documentation. The MDN SVG page documents the export format the download produces.
Sources and further reading
- PostgreSQL: CREATE TABLE reference (constraint grammar)(postgresql.org)
- SQLite: FOREIGN KEY support and parent/child semantics(sqlite.org)
- Mermaid: Entity Relationship Diagram syntax(mermaid.js.org)
- MDN Web Docs: SVG, the export format(developer.mozilla.org)
We cite primary sources (standards bodies, government agencies, official documentation) wherever they exist so you can verify every number on this page yourself.