RunLocalTools

SQL to ER Diagram — Free Entity-Relationship Diagram Generator

Paste a CREATE TABLE dump and get a visual entity-relationship diagram — tables, columns, primary/foreign keys, and draggable layout, with PNG/SVG/HTML export. Nothing is uploaded.

What it does

Paste or drop a SQL schema dump and this tool draws it as an entity-relationship diagram: one box per table listing its columns with PK/FK markers, connected by lines showing each foreign key relationship. Tables are draggable so you can rearrange a diagram to your liking, the canvas supports pan and zoom for large schemas, and you can export the result as a PNG, an SVG, or a self-contained HTML file.

How it works

The same tolerant CREATE TABLE parser used across this site’s SQL tools reads your dump — it handles MySQL backticks, PostgreSQL/SQLite double quotes, and SQL Server brackets, along with inline and table-level primary key, foreign key, and unique definitions. Once every table is parsed, tables are auto-arranged into a grid sized to the number of tables and the number of columns in each one, and foreign keys are drawn as curved connector lines routed between the nearest facing edges of the two boxes involved.

Hovering a table highlights every table it’s directly connected to (in either direction) and dims everything else, which is the fastest way to trace a relationship chain through a schema with dozens of tables. Dragging a table box repositions it — your custom layout is remembered in this browser, and an “Auto-layout” button resets everything back to the computed grid if you want to start over.

How to use it

  1. Paste your CREATE TABLE dump, or drop a .sql file.
  2. Use the sidebar’s table list to jump to a specific table, or type into the search box to filter it.
  3. Drag any table box to reposition it — the layout is saved automatically.
  4. Hover a table to see its direct relationships highlighted; click it to keep that focus while you scroll or zoom elsewhere.
  5. Toggle column types on or off for a cleaner view on wide schemas.
  6. Export as PNG or SVG for docs and slides, or as a standalone HTML file you can open in any browser without this tool.

Limitations

The auto-layout is a grid, not a relationship-aware layout algorithm — for schemas with a lot of cross-cutting foreign keys, you’ll likely want to drag a few tables around for a clearer picture, which the tool supports but doesn’t do automatically. Tables wider than 8 columns show a “+N more” indicator rather than growing indefinitely tall, to keep large schemas legible; toggling column types off can help fit more on screen at once. As with the other SQL tools here, this reads the dump you provide — it doesn’t connect to a live database.

FAQ

Does this connect to a live database? No — it only parses the CREATE TABLE SQL you paste or upload. Nothing is sent anywhere.

Can I rearrange the diagram? Yes — every table box is draggable. Your layout is saved in this browser automatically, and “Auto-layout” resets it to the computed grid.

What do PK and FK mean on the diagram? PK marks a primary key column, FK marks a foreign key column (one referencing another table). A column that’s both shows PK, FK together.

Why don’t all my columns show? To keep large tables readable, only the first 8 columns are listed with a “+N more” note below. Full column detail (including type) is available in the SQL → Markdown table generator if you need a complete reference.

Can I export this to use outside the browser? Yes — download as PNG for a static image, SVG for an editable vector version, or standalone HTML to open the diagram in any browser without this site.

Does it detect relationships that aren’t declared as foreign keys? No — only explicit FOREIGN KEY / REFERENCES constraints are drawn as relationships. A column that’s conventionally a reference (like an untyped user_id) without an actual constraint won’t show a connector.

If you’re tracking how a schema has changed rather than visualizing its current shape, the SQL schema diff checker compares two versions of a dump table-by-table and can generate migration SQL. For a text-based reference instead of a diagram, the SQL → Markdown table generator turns the same dump into README-ready documentation tables.