Mermaid ER Diagram Tool

Design entity-relationship diagrams for database schemas with Mermaid syntax — live preview, SVG/PNG export, no account.

Runs 100% in your browser. Your input and files never leave your device.

Why use our online Mermaid ER Diagram Tool?

Create ER diagrams for database schemas with Mermaid syntax — define entities, attributes, and cardinality with live preview.

How to use Mermaid ER Diagram Tool

  1. 1
    Declare your entities

    Start with the entity name followed by curly braces. Inside, list each attribute with its type: string name, int id PK.

  2. 2
    Define relationships

    Connect entities with cardinality notation: CUSTOMER ||--o{ ORDER : places. The symbols define one-to-one, one-to-many, and many-to-many relationships.

  3. 3
    Add primary and foreign keys

    Append PK after an attribute name for primary keys, FK for foreign keys: string customerId FK.

  4. 4
    Export for documentation

    SVG is ideal for embedding in design docs, Notion, or Confluence. PNG at 2× works well in Markdown README files.

Frequently Asked Questions

What do the cardinality symbols mean in a Mermaid ER diagram?

|| means exactly one, o| means zero or one, }| means one or more, and }o means zero or more. The left side describes the first entity, the right describes the second.

How do I mark a primary key in a Mermaid ER diagram?

Append PK to the attribute: string userId PK. For foreign keys, use FK: string orderId FK.

Can I show relationship labels?

Yes. The label comes after the colon at the end of the relationship line: CUSTOMER ||--o{ ORDER : "places". Quotes are required for labels with spaces.

Is this the same as a UML class diagram?

ER diagrams and class diagrams look similar but serve different purposes. ER diagrams model database tables and relationships. Class diagrams model object-oriented code with methods, inheritance, and composition.

Can I use this ER diagram in database design tools?

You can export the SVG or PNG and reference it in any tool. To generate SQL DDL from a schema, try the SQL to ORM Converter on this site.

Also useful: Markdown EditorSVG Converter