Free Online ER Diagram Tool
An entity-relationship diagram maps a database schema: which tables exist, which columns belong to each one, and how rows in one table relate to rows in another. The relationship symbols encode cardinality — one row to many, many to many — directly in the line between two entities.
Because the schema is text, it can be generated straight from a migration file or a design doc and kept next to it, instead of drifting out of sync with a diagram drawn once in a separate tool.
A normalized orders schema
Mermaid source
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ ORDER_ITEM : contains
PRODUCT ||--o{ ORDER_ITEM : "ordered in"
CUSTOMER {
int id PK
string name
string email
}
ORDER {
int id PK
int customer_id FK
date placed_at
}
ORDER_ITEM {
int order_id FK
int product_id FK
int quantity
}
PRODUCT {
int id PK
string name
decimal price
}||--o{ reads as exactly-one on the left, zero-or-many on the right — one customer places zero or more orders. The {} block under an entity lists its columns, and PK / FK mark primary and foreign keys.
A blog schema with a many-to-many relationship
Mermaid source
erDiagram
AUTHOR ||--o{ POST : writes
POST }o--o{ TAG : "tagged with"
AUTHOR {
int id PK
string name
}
POST {
int id PK
int author_id FK
string title
}
TAG {
int id PK
string label
}}o--o{ puts zero-or-many on both sides, the notation for a many-to-many relationship — a post can carry several tags and a tag can label several posts, which in a real schema means there's a join table underneath even though it isn't drawn here.
Questions
What do symbols like ||--o{ mean?
Each end of the line is read separately. || means exactly one, o| means zero or one, o{ means zero or many, and |{ means one or many. Reading CUSTOMER ||--o{ ORDER left to right: one customer relates to zero or more orders.
How do I add columns to an entity?
Add a block under the entity name: EntityName { type columnName }. Repeat one line per column, and append PK or FK after a column to mark it as a primary or foreign key, which Mermaid renders as a small tag next to the name.
Can I show a many-to-many relationship without a join table?
Yes — write it directly as }o--o{ between the two entities, as in the blog example above. Mermaid draws the relationship without requiring you to model the join table as its own entity, which keeps the diagram focused on the domain concepts.