Skip to content
M2TOOLKIT

Editors · free tool

SQL to ERDTurn CREATE TABLE into a Diagram

Paste your schema and get a clean, editable entity relationship diagram in seconds — keys, foreign keys and indexes included.

Create and download as many as you want — it's free, with no watermark from us and no sign-up.

  • Editors
  • Free
  • No sign-up
  • Runs in your browser
  • Updated

Full-screen editor

Design your database in a full-screen editor

Draw tables and relationships on a large canvas with an outline on the left and properties on the right.

  • Tables, columns, primary and foreign keys
  • Crow's-foot relationships with cardinality
  • Import SQL or DBML, generate SQL for PostgreSQL, MySQL, SQL Server and SQLite
  • Export PNG, SVG or PDF

Free, no sign-up — your work saves in this browser.

  1. 1Paste your SQL, or start from scratch.
  2. 2Tables and relationships are drawn for you.
  3. 3Generate SQL for your database, or export an image.

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us.

How to convert SQL to ERD

  1. Paste CREATE TABLE statements into the box that opens, or open a .sql file. Schema-only dumps work best: pg_dump --schema-only, mysqldump --no-data, or “Script table as CREATE” in SQL Server Management Studio.
  2. Check the summary: the number of tables and relationships found, the dialect it looks like, and any notes. If something can't be parsed you'll see the exact line and the reason.
  3. Choose Create diagram. Tables are laid out with referenced tables above the ones that point at them. Drag, recolour or rearrange anything, then export PNG, SVG or PDF — or generate SQL for another database.

What does this tool do?

Reading a schema as text gets hard after a dozen tables. A diagram shows at a glance which tables depend on which, where the many-to-many junction tables are and which foreign keys are optional. The importer understands inline REFERENCES, table-level FOREIGN KEY constraints, ALTER TABLE … ADD CONSTRAINT added later in the script, composite primary keys, UNIQUE constraints, CREATE INDEX and CREATE UNIQUE INDEX, defaults, and auto-increment in each dialect's syntax: SERIAL and IDENTITY columns in PostgreSQL, AUTO_INCREMENT in MySQL, IDENTITY(1,1) in SQL Server and AUTOINCREMENT in SQLite.

Relationship ends are inferred from the constraints. A nullable foreign key gets an optional parent end; a foreign key that is also unique becomes one-to-one. Statements that don't describe structure — INSERT, DROP, SET, USE, views and functions — are skipped and counted, not guessed at. Everything happens in your browser, so private schemas never leave your computer.

Privacy

Everything you type is processed in your browser. Nothing you enter is sent to our servers or stored by us. There's no account to create and nothing to install.

Frequently asked questions

Which SQL dialects can it read?

PostgreSQL, MySQL and MariaDB, SQL Server (including GO batch separators and [bracketed] names) and SQLite. Mixed scripts are fine; the detected dialect is shown before you import.

What if my SQL has errors?

Problems that would produce a wrong diagram — an unclosed bracket or quote, a table with no column list, a PRIMARY KEY naming a column that doesn't exist — are reported with their line number, and you can click to jump there. You can still import the tables that parsed if you choose to.

Can I add tables from a second script?

Yes. When a diagram already exists, choose “Add to diagram” and the new tables are placed beside the current ones, renamed if a name is already taken.

Does it read my data?

No. INSERT statements are ignored, and nothing you paste is uploaded — the parser runs in your browser.

Last reviewed by the M2Toolkit team.

Other tools people use alongside the sql to erd.