Mermaid ER diagram online editor
Document database entities, fields, relationships, and cardinality. Create the diagram in Mermaid Studio, preview it instantly, and export it when it is ready to share.
WHAT IT IS FOR
Make the important relationships clear
Describe database entities, fields, keys, relationships, and cardinality in a readable ERD that teams can maintain with code.
- Plan a relational database
- Document an existing schema
- Review ownership and cardinality with engineers
MERMAID EXAMPLE
Start with a working example
Copy the structure, replace the labels with your own domain, and continue in the full editor.
erDiagram
USER ||--o{ PROJECT : owns
PROJECT ||--o{ REVISION : contains
USER {
string id PK
string email
}
PROJECT {
string id PK
string ownerId FK
string title
}HOW TO START
Create your diagram in four steps
- 1Identify the entities and their boundaries.
- 2Add primary and foreign key fields.
- 3Connect entities with the correct cardinality.
- 4Compare the diagram with the schema before implementation.
WRITING TIPS
Keep the diagram useful
Mark primary and foreign keys clearly.
Use Mermaid cardinality symbols for each relationship.
FAQ
Frequently asked questions
What is an ER diagram used for?+
An entity-relationship diagram is used to plan and explain how database entities relate to one another.
Can Mermaid ER diagrams show primary keys?+
Yes. Mermaid ER syntax supports field attributes so primary keys, foreign keys, and other important fields can be documented.
TEMPLATES
Start from a related template
RELATED DIAGRAMS
Explore another Mermaid diagram
Mermaid flowchart
Visualize processes, decisions, and system flows with connected nodes.
Read the guideMermaid sequence diagram
Map requests, responses, and asynchronous events between services.
Read the guideMermaid class diagram
Design domain objects, properties, methods, inheritance, and relationships.
Read the guideMermaid state diagram
Show how an object or workflow changes state in response to events.
Read the guideMermaid mindmap
Organize ideas and subtopics hierarchically around a central theme.
Read the guideMermaid Gantt chart
Plan projects with tasks, milestones, dependencies, and dates.
Read the guideReady to make a ER?
Open the editor with a working example and adapt it to your project.
Start in Mermaid Studio