Free · No sign-up · Paste-ready for GitHub

SQL to Mermaid erDiagram

Paste your DDL, hit Generate, hit Copy Mermaid — an erDiagram block your README, PR description or docs site renders natively. No screenshots to go stale.

SQL input — CREATE TABLE · DDL · dumpauto-detect
Sample: · · · · ·
Diagram—

Your diagram renders here.

The export

What lands on your clipboard

An excerpt from the sample above, exactly as the export writes it — attribute lines are type name with PK/FK marks, and every foreign key becomes a relationship line whose label carries the on-delete rule:

erDiagram
  customers {
    bigint id PK
    text email
    text region
    timestamptz created_at
  }
  orders {
    bigint id PK
    bigint customer_id FK
    text status
    timestamptz placed_at
  }
  order_items {
    bigint order_id PK
    bigint product_id PK
    int quantity
  }
  order_items }o--|| orders : "order_id on delete cascade"
  orders }o--|| customers : "customer_id on delete restrict"
Why text beats screenshots

A schema diagram that diffs

  • Renders where you write — GitHub and GitLab draw ```mermaid blocks in READMEs, issues and PRs natively
  • Reviews it like code — a column change is a one-line diff, not a re-exported image attachment
  • Never goes stale — the block lives next to the migrations that changed the schema, so it gets updated with them
  • Same source of truth — generated from your actual DDL, not from a diagram someone drew by hand last year
FAQ

Questions, answered

How do I convert SQL to a Mermaid diagram?

Paste your CREATE TABLE statements above, hit Generate, then Copy Mermaid. The parser reads tables, columns and foreign keys and writes an erDiagram block you can drop straight into any Markdown file.

Does GitHub render Mermaid erDiagram blocks?

Yes — fenced ```mermaid code blocks render natively in READMEs, issues, pull requests and comments, on GitHub and GitLab. Notion and Obsidian render them too, so the same block works everywhere your schema docs live.

What ends up in the erDiagram block?

Every table with its columns and types, PK and FK marks on the key columns, and one relationship line per foreign key — the label carries the ON DELETE behavior, so cascade rules survive the round-trip into text.

Is it free?

Converting is free and unlimited up to 50 tables, no sign-up. Pro ($9/mo) lifts the ceiling to 500 tables — details on the pricing page.