DBML to Mermaid
Paste DBML and export it as a Mermaid erDiagram you can drop into Markdown, GitHub or your docs — while you preview the live, interactive diagram.
How it works
- Paste your DBML (from dbdiagram.io or a
.dbmlfile) — DBML is auto-detected. - The diagram renders instantly so you can confirm tables and relations.
- Click Export → Mermaid and copy the
erDiagramcode. - Drop it into any Mermaid-aware Markdown (GitHub, GitLab, Notion, Obsidian…).
Example
This DBML:
Table users {
id integer [pk]
email varchar [unique]
}
Table posts {
id integer [pk]
user_id integer [ref: > users.id]
}
…exports as this Mermaid:
erDiagram
users {
integer id PK
varchar email
}
posts {
integer id PK
integer user_id FK
}
users ||--o{ posts : "user_id"
Copy it from Export → Mermaid. Try it with your own →
Guide
This conversion maps DBML's relational model onto Mermaid's erDiagram grammar: each Table becomes an entity block, [pk]/[unique]/[ref: settings become PK/UK/FK attribute markers, and each Ref: line becomes a relationship with matching cardinality — a one-to-many > ref becomes ||--o{, a one-to-one - ref becomes ||--||.
The destination matters: Mermaid renders natively in GitHub, GitLab, Notion, Obsidian and most static-site generators. Converting DBML → Mermaid is how you take a schema that lives in a DBML toolchain (dbdiagram, dbdocs) and put it in a README that must render without JavaScript or images — Mermaid blocks are text, so they diff, review and survive repo moves.
As with every export on this site, the live diagram is the proof: what you see on the canvas before copying is exactly what the Mermaid encodes, because both come from the same parse. If a Ref is missing from the render, it was missing from the DBML — fix it once, export again.
Why use it
- Private: everything runs in your browser — nothing is uploaded or stored on a server.
- Paste-ready Mermaid for GitHub / GitLab / Notion / Obsidian.
- Round-trip — import DBML, export Mermaid, PlantUML, PNG or SVG.
- Free & open source — no account, no sign-up.
FAQ
How do I convert DBML to Mermaid?
Paste your DBML, then click Export → Mermaid and copy the erDiagram code. Tables become entities and Ref: relations become Mermaid 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.