Skip to content
← Developer Tools
🔒All processing in your browser 🚫Nothing uploaded Free, no login

SQL DDL to ER Diagram — Visualize Tables & Relationships

Paste CREATE TABLE statements and instantly generate an interactive entity-relationship diagram. Primary keys, foreign keys, and relationships are detected automatically. Export to SVG, PNG, or Mermaid syntax. Everything runs locally — your schema never leaves the browser.

INPUT SQL DDL
Paste DDL and click Generate.
🗂️

Paste SQL DDL on the left and click Generate Diagram to visualize your schema.

  • No warnings yet. Generate a diagram first.

What This Tool Does

The DDL to ER Diagram tool takes SQL CREATE TABLE statements — the Data Definition Language that defines your database schema — and produces a visual entity-relationship diagram showing how tables connect. It parses primary keys, foreign keys, column types, and nullable constraints to build an accurate model of your schema.

Supported DDL Patterns

Relationship Detection

The parser identifies three categories of relationships:

PatternDetectionDiagram Notation
One-to-ManyStandard FOREIGN KEY referencing another table's PRIMARY KEYParent ──┤ Child (crow's foot)
Many-to-ManyJoin table with composite PK of exactly two FK columns pointing to different tablesTable A ┤──├ Table B (via join table)
Self-ReferenceFOREIGN KEY referencing the same table (e.g., Employee → Manager)Curved arrow back to same table

Export Formats

SVG — Scalable Vector

Lossless vector format. Ideal for documentation, wikis, and presentations. SVG files stay crisp at any zoom level and can be edited in tools like Figma, Illustrator, or Inkscape.

PNG — Raster Image

Pixel-based export at 2× resolution. Best for embedding in Slack messages, Confluence pages, emails, and README files where an image tag is simpler than inline SVG.

Mermaid Syntax

Text-based ER diagram markup compatible with Mermaid.js. Renders automatically in GitHub README files, Notion, GitLab wikis, Obsidian, and many other platforms. Paste the generated syntax into a ```mermaid code fence and the diagram renders inline.

🔒 Your Schema Stays on Your Machine

Database schemas contain table names, column names, and relationship structures that reveal your application's data architecture. This tool processes everything in your browser's JavaScript engine — your DDL never leaves your device, is never transmitted to any server, and is never logged.

You can verify this by opening your browser's Network panel (F12 → Network) and observing that no requests contain your SQL input.

Frequently Asked Questions

What SQL dialects does the DDL to ER Diagram tool support?
The parser handles standard CREATE TABLE syntax used by SQL Server, PostgreSQL, MySQL, SQLite, and Oracle. It supports schema-qualified names, bracket and double-quote identifiers, inline and table-level PRIMARY KEY constraints, and FOREIGN KEY … REFERENCES declarations.
Can I use this tool with production database schemas?
Yes. The tool runs entirely in your browser — your SQL DDL is never transmitted to any server. You can safely paste production schema definitions without any data exposure risk.
How does it detect relationships between tables?
The parser identifies FOREIGN KEY constraints (both inline and table-level, with optional CONSTRAINT names) and creates relationship edges between the referencing and referenced tables. It also detects many-to-many join tables where a table has a composite primary key of exactly two columns, both of which are foreign keys to different tables.
What export formats are available?
You can export the diagram as SVG (vector, scalable), PNG (raster image), or Mermaid ER syntax (text-based diagram markup compatible with Mermaid.js, GitHub, Notion, and other tools).