SQL to ER Diagram
Home › SQL to Mermaid

SQL to Mermaid

Paste your SQL CREATE TABLE statements and get a Mermaid erDiagram you can copy straight into Markdown, GitHub, or your docs — plus a live, interactive diagram.

Open the diagram tool →
No signup · nothing uploaded · export PNG / SVG / Mermaid / DBML · shareable link

How it works

  1. Paste your SQL schema into the editor (PostgreSQL, MySQL, SQLite or SQL Server).
  2. The diagram renders instantly so you can check it.
  3. Click Export → Mermaid and copy the erDiagram code.
  4. Drop it into any Mermaid-aware Markdown (GitHub, GitLab, Notion, Obsidian…).

Example

This SQL:

CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email TEXT UNIQUE
);
CREATE TABLE posts (
  id SERIAL PRIMARY KEY,
  user_id INT REFERENCES users(id)
);

…exports as this Mermaid:

erDiagram
    users {
        serial id PK
        text email
    }
    posts {
        serial id PK
        int user_id FK
    }
    users ||--o{ posts : "user_id"

Copy it from Export → Mermaid. Try it with your own →

Why use it

SQL → MermaidSQL → DBMLSQL → PlantUMLPNG / SVG

FAQ

How do I convert SQL to a Mermaid ER diagram?

Paste your CREATE TABLE statements, then click Export → Mermaid and copy the erDiagram code. Foreign keys become relationships.

Where can I use the Mermaid output?

Anywhere Mermaid renders: GitHub & GitLab Markdown, Notion, Obsidian, docs sites, and the Mermaid Live Editor.

Is my schema uploaded anywhere?

No. Everything runs locally in your browser — your schema is never uploaded to or stored on any server.

Is it free?

Yes. It is completely free and open source, with no account or sign-up required.

Related