SQL DDL to ER Diagram

Paste your CREATE TABLE statements and get an entity-relationship diagram as SVG, with primary keys, foreign keys and crow's-foot relationship lines drawn for you.

Use the tool

Why this tool exists

Schemas live in migration files and dump scripts, and nobody can see the shape of a database by reading forty CREATE TABLE statements. You need a picture when you join a project, review a pull request that adds three tables, or explain the data model to a colleague who does not read SQL.

Most diagram tools want an account, a database connection or an upload of your schema. This one reads the DDL you paste, draws the diagram locally and hands back an SVG you can drop into documentation. Your table and column names, which often reveal how a business works, stay on your machine.

How to use it

  1. Paste your CREATE TABLE statements, and any ALTER TABLE ... ADD FOREIGN KEY lines, into the box.
  2. Choose the layout direction: LR for left to right or TB for top to bottom.
  3. Pick an edge style: curved, orthogonal or straight lines between tables.
  4. Check the rendered diagram, then download or copy the SVG for your docs.

Frequently asked questions

Which SQL dialects does it understand?

Generic SQL plus common MySQL, PostgreSQL and SQLite syntax for CREATE TABLE, PRIMARY KEY, FOREIGN KEY, inline REFERENCES, UNIQUE, NOT NULL and ALTER TABLE ... ADD FOREIGN KEY. Statements it does not recognise, such as INSERT or CREATE INDEX, are ignored.

Why is a relationship line missing?

Lines are drawn only from declared foreign keys. If your schema relies on naming conventions such as user_id without a REFERENCES clause, the tool has nothing to connect. Add the constraint, or an ALTER TABLE statement, and the line appears.

Does it connect to my database?

No. It only reads the text you paste, so there is no connection string, login or upload. Export the schema with your usual dump command, paste it here, and the diagram is built inside the page.

Can I edit the diagram by hand afterwards?

The output is an SVG, which you can open in any vector editor. For a text-based alternative that you keep in version control, write the structure in Mermaid and use the Mermaid renderer instead.