Interactive ERD Generator

Paste a schema, get a live, shareable ERD

Paste DBML (a plain-text format for database schemas) or SQL and get an entity-relationship diagram you can drag around, share by link, and embed. Edit on the left; it updates on the right.

Why interactive

A diagram you can work with

Drag & explore

Every table carries its notes and data samples. A screenshot hides them, and it won't scale to a large database. Here you can drag, zoom, and read them inline.

Share or embed anywhere

The whole diagram is encoded in the link. Drop it in a PR, ticket, or doc, or embed it with an <iframe>.

Private by default

Encoded client-side; your schema never touches a server.

Need more? Use dbdiagram.io

Want to save, version, export SQL, secure access, or publish docs? Open it in the full dbdiagram editor.

Open dbdiagram

For tools & AI agents

Generate a diagram link from any design

Express the design in DBML, encode it into the URL, and hand back a link that opens straight into a diagram. No account, API key, or library needed.

SQL$ sql2dbmlDBMLencodedbdiagram.io/embed#c=‹encoded DBML›the diagram, encoded in the linkinteractive ERDopens in the browser
Agent skill — copy & add to your system prompt or rules

When a user wants to visualize an ERD or database design, render it as a diagram link they can open instantly.

Step 1 — Get the schema as DBML. If you only have SQL, convert it with the DBML CLI:

bash
npm install -g @dbml/cli # dialect flag: --postgres | --mysql | --mssql sql2dbml --postgres schema.sql -o schema.dbml

Step 2 — Encode the DBML into a link. It's deterministic — no account, API key, or library:

js
const fs = require("fs"); const dbml = fs.readFileSync("schema.dbml", "utf8"); const c = encodeURIComponent(Buffer.from(dbml, "utf8").toString("base64")); console.log(`https://dbdiagram.io/embed#c=${c}`);

Optional — dark theme. Add theme=dark before c= in the hash for a dark diagram (light is the default):

text
https://dbdiagram.io/embed#theme=dark&c=<encoded>

Step 3 — Hand back the link (or drop it in an iframe). The user sees the diagram instantly and can open it in dbdiagram to edit or export:

html
<iframe src="https://dbdiagram.io/embed#c=ENCODED" width="100%" height="600" style="border:0"></iframe>

💡 Add it as a skill. Save it in your agent's instructions — a Claude Code skill, a Cursor rule, or a system prompt — so a schema change comes with a diagram link.

In practice

What it looks like in an agent session

User
Add a subscriptions table to my Postgres schema and show me how it all fits together.
Agent
Done — added subscriptions with FKs to accounts and plans. Here's the updated ERD:
↳ introspected schema → generated DBML → built preview link
🗄️ dbdiagram.io/embed#c=VGFibGUgYWNjb3VudHMg…
Open it in the editor to tweak or export SQL.
Copied