SQL Schema Visualizer

Paste SQL DDL to inspect the detected database structure. Review the diagram and reuse its Mermaid source in your documentation.

Runs locally in your browser
This tool processes all data locally in your browser.
Database schema DDLPaste CREATE TABLE statements. Direct foreign-key REFERENCES become relationship lines in the diagram.

How to turn pasted CREATE TABLE statements into a Mermaid ER diagram

Paste one or more CREATE TABLE statements and the page renders the tables, their columns and the foreign keys between them: Mermaid erDiagram source in the output pane, a small SVG preview underneath that the page draws itself.

MySQL backticks, PostgreSQL double quotes, SQL Server square brackets, IF NOT EXISTS and schema.table prefixes are all read, and -- or /* */ comments are ignored. Nothing is uploaded and no database connection is opened.

  1. Paste the DDL into the box on the left, or press Load example for a two-table sample.
  2. Press Render diagram. The Mermaid source appears in the right-hand pane and the preview below it.
  3. Read the status line: it counts the tables and relationships, and names any DDL line the parser could not read.
  4. Press Copy to take the Mermaid source, or Download to save it as database-schema.mmd.
  5. Press Clear to empty the input, the output pane and the preview in one step.

What the diagram shows, which dialects are read, and what the tool does not do

Tables, keys and relationship edges

Every table becomes a card listing its columns in declaration order. Primary key columns carry PK, columns used by a foreign key carry FK, and a composite key marks all of its columns. A key declared twice - inline as REFERENCES and again as a table-level FOREIGN KEY - is counted once and drawn as a single edge.

An edge runs from the referenced table to the table that declares the key, and its label names the key column, so users ||--o{ projects : "owner_id" reads as: one user row owns many project rows. Connectors leave and enter a card at its edge and a self-reference loops around the right side of its own card, so no line crosses a table body.

Repeated names, missing tables and unread lines

A name alone does not identify a table. When a.users and b.users are both in the paste, the Mermaid source keeps them apart as users and users_2 while the cards keep the qualified labels. A foreign key whose target table is not part of the paste keeps its edge and is drawn as a dashed placeholder instead of disappearing.

The status line reports what the diagram does not contain: how many DDL lines could not be read, and how many relationships point outside the pasted text. A paste with no CREATE TABLE at all clears both panes and says why, rather than leaving the previous diagram on screen.

What it is not, and what stays on your machine

This is a diagram builder, not a database client: it does not connect to a server, execute SQL, read a running schema or produce migrations. It renders the text you paste, and the Mermaid source is meant for documentation and review.

The whole tool runs in the browser; once the page has loaded it requests nothing further and it keeps working offline. Copy and Download stay inactive until a diagram has been rendered, so an empty clipboard or a zero-byte file cannot be mistaken for a result. Diagram size is limited only by the memory of the tab.

Recent tools: