🔗

ERD Generator

Generate Entity-Relationship Diagrams from Mermaid ERD syntax

Input
ERD Diagram
🔒 All processing runs in your browser. Your data is never sent to any server.

📖 What is this tool?

An entity-relationship diagram (ERD) shows database tables, their columns and how tables relate to each other through foreign keys. This generator uses Mermaid ERD syntax: you define entities with typed attributes and connect them with relationship lines (one-to-one, one-to-many, many-to-many). Choose from Blog DB, E-Commerce and SaaS templates, or model your own schema from scratch. Use it to plan a new database, document an existing one, or communicate schema changes with your team. Everything runs in your browser — your schema is never uploaded.

💡 Example

Input
erDiagram USER ||--o{ ORDER : places ORDER ||--|{ ITEM : contains
Output
Live ERD with entities and relationship connectors

🛠️ Common Use Cases

  • Design database schemas visually
  • Document table relationships for teams
  • Plan data models before coding
  • Review existing database structure
  • Create database documentation

📝 Mermaid ERD Syntax Reference

  • erDiagram — starts an ERD block
  • USERS { int id PK } — entity with a column (type, name, constraint)
  • Column constraints: PK (primary key), FK (foreign key), UK (unique)
  • USERS ||--o{ ORDERS : places — one user places many orders
  • Cardinality symbols: || (exactly one), o| (zero or one), }| (one or more), }o (zero or more)
  • The label after the colon describes the relationship verb (e.g. "places", "contains", "belongs to")

⚠️ Common Mistakes

  • Confusing cardinality direction — read the symbols at each end of the line: ||--o{ means "exactly one to zero-or-many"
  • Forgetting the relationship label — the colon and verb after the entity names are required (USERS ||--o{ ORDERS : places)
  • Using spaces in entity names — multi-word names like Order Items break the syntax; use ORDER_ITEMS or OrderItems
  • Skipping column types — while types are optional in Mermaid, including them (int, varchar, datetime) makes the ERD useful as real documentation

❓ Frequently Asked Questions

What do the relationship symbols mean?
||--|| is one-to-one, ||--o{ is one-to-many, }o--o{ is many-to-many. The | means exactly one, o means zero or one, { means one or many, } means zero or many.
How do I add attributes to entities?
Inside the entity block: USER { int id PK\n string name\n string email UK }. PK = Primary Key, UK = Unique Key, FK = Foreign Key.
Can ERDs be used for NoSQL databases?
ERDs are primarily for relational databases. For NoSQL, use them to show document relationships conceptually, though the strict relational semantics don't apply.
How do I show a many-to-many relationship?
Use }o--o{ between the two entities. In practice, many-to-many relationships usually need a junction table — add a third entity (e.g. ENROLLMENTS) with one-to-many relationships to both sides.
Can I model inheritance or subtypes?
Mermaid ERD does not support inheritance notation directly. The common workaround is to model subtypes as separate entities with a foreign key back to the parent entity.
How do I represent nullable foreign keys?
Use the "zero or one" cardinality: o|--o{ means the relationship is optional on the left side. This visually indicates that the foreign key column allows NULL.
🔒
Your data stays private. All processing happens entirely in your browser. Nothing is ever sent to our servers. You can use this tool offline after the page loads.