SQL to ER Diagram
Paste CREATE TABLE statements and get an entity-relationship diagram instantly — tables, columns, PK/FK flags and crow's-foot relationships. Export SVG or PNG. Free, runs in your browser.
About SQL to ER Diagram
Paste your CREATE TABLE statements — MySQL, PostgreSQL, SQLite or SQL Server dialect, with backticks, quotes or brackets — and this tool extracts the tables, columns, primary keys and foreign keys, then renders an entity-relationship diagram with crow's-foot cardinality. Table-level and inline REFERENCES constraints are both picked up, along with ALTER TABLE … ADD FOREIGN KEY statements.
The diagram is generated as Mermaid erDiagram code (shown and copyable, so you can paste it into docs or a wiki) and rendered entirely in your browser — your schema never leaves the machine. Nullable foreign keys are drawn as optional relationships, unique single-column FKs as one-to-one. Download the result as SVG or a 2× PNG.
How to use SQL to ER Diagram
- Paste one or more CREATE TABLE statements into the editor, or load the sample schema.
- The ER diagram re-renders automatically — tables show columns with PK/FK flags, foreign keys become crow's-foot relationships.
- Copy the generated Mermaid source for your docs, or download the diagram as SVG / PNG.
Frequently asked questions
Which SQL dialects are supported?
MySQL backticks, Postgres/SQLite double quotes and SQL Server brackets all parse. Table-level PRIMARY KEY / FOREIGN KEY constraints, inline REFERENCES and ALTER TABLE … ADD FOREIGN KEY are recognized.
How is cardinality decided?
The parent side is always 'one'. A NOT NULL foreign key draws 'one to zero-or-many' (or one-to-one when the FK column is UNIQUE); a nullable FK draws an optional relationship.
Is my schema uploaded?
No — parsing and Mermaid rendering both run in your browser. Nothing is sent to a server.