Blog
Wild & Free Tools

How to Create an ER Diagram: Step-by-Step Guide

Last updated: April 2, 2026 7 min read

Table of Contents

  1. What is an ER diagram
  2. Step 1: Identify your entities
  3. Step 2: Define attributes for each entity
  4. Step 3: Map the relationships
  5. Step 4: Write or draw the diagram
  6. Step 5: Review and refine
  7. Common mistakes to avoid
  8. Frequently Asked Questions

An entity-relationship diagram (ERD) is a visual map of your database — showing what data you store, what properties each thing has, and how everything connects. This guide walks through building one from scratch, even if you have never drawn one before.

What Is an ER Diagram and When Do You Need One?

An ER diagram shows three things:

  1. Entities — the objects or things in your system (User, Product, Order, Post)
  2. Attributes — the properties of each entity (User has a name, email, created date)
  3. Relationships — how entities connect (a User places many Orders)

You need an ERD when you are:

The diagram does not run any code or create any tables itself — it is a communication tool. Once it is agreed on, you write the SQL (or whatever your ORM uses) to build the real schema.

Step 1: Identify Your Entities

Start by listing every distinct "thing" your system needs to track. Ask: what nouns does the business care about?

For an online bookstore, the answer might be: Customer, Book, Author, Order, Review, Category.

Rules for identifying entities:

Start with 4–8 entities. You can add more as you work through the relationships. Starting too large makes the diagram unreadable.

Step 2: Define Attributes for Each Entity

For each entity, list the data points you need to store. Focus on what the system actually uses — not every column you might ever want.

Example for a Customer entity:

Mark your primary key with PK. If the table references another entity, you will add a foreign key (FK) attribute later when you define the relationship.

Tip: Do not over-specify at this stage. The ERD is a design tool, not a contract. You will add and remove attributes as the design evolves. Start lean.

Sell Custom Apparel — We Handle Printing & Free Shipping

Step 3: Map the Relationships Between Entities

Now connect the entities. For each pair that has a connection, define:

  1. The verb that describes the relationship ("places", "belongs to", "contains")
  2. The cardinality — how many of each can exist on each side

The three cardinality types:

TypeMeaningExample
One-to-oneEach A has exactly one B, and each B has exactly one AUser has one Profile
One-to-manyOne A can have many B, but each B belongs to one ACustomer places many Orders
Many-to-manyOne A relates to many B, and one B relates to many AStudent enrolls in many Courses; Course has many Students

Many-to-many relationships require a junction (bridge) table in a relational database. For example, a Student-Course many-to-many becomes three entities: Student, Enrollment, Course — where Enrollment has foreign keys to both.

Step 4: Write or Draw the Diagram

With your entities, attributes, and relationships defined, you are ready to build the diagram. Use the free ERD maker above:

  1. Type erDiagram on the first line
  2. Define each entity with its attributes inside curly braces
  3. Add relationship lines below the entity definitions
  4. The diagram renders live as you type

Example using the bookstore from Step 1:

erDiagram
    CUSTOMER {
        int id PK
        string name
        string email UK
    }
    BOOK {
        int id PK
        string title
        decimal price
        int authorId FK
    }
    ORDER {
        int id PK
        int customerId FK
        date createdAt
    }
    CUSTOMER ||--o{ ORDER : places
    ORDER }o--|| BOOK : contains

When the diagram looks right, export as PNG or SVG for sharing or documentation.

Step 5: Review and Refine

Once you have a first draft, ask these questions:

Show the diagram to someone who knows the business problem but not the database. If they can read the diagram and understand what data the system stores, it is a good design. If they have questions the diagram cannot answer, add the missing information.

Common ER Diagram Mistakes

Build Your First ER Diagram Free

No signup, no install. Type your schema, export PNG or SVG. Takes less than 5 minutes for a basic design.

Open Free ERD Maker

Frequently Asked Questions

What is the easiest way to create an ER diagram?

The fastest approach for most developers is a text-based tool using Mermaid erDiagram syntax. You describe your entities and relationships as plain text, and the tool renders the diagram automatically. No drag and drop, no manual layout. Open the free ERD maker above and type erDiagram on the first line to get started.

What are the three components of an ER diagram?

An ER diagram has three main components: entities (the objects or things in your system, like User or Product), attributes (the properties of each entity, like name or price), and relationships (how entities connect to each other, including cardinality — one-to-one, one-to-many, or many-to-many).

How do I show a many-to-many relationship in an ER diagram?

Many-to-many relationships are represented with a junction table (also called a bridge or associative table) that sits between the two entities and holds foreign keys to both. For example, Student and Course connected many-to-many becomes Student, Enrollment, and Course — with Enrollment containing studentId FK and courseId FK.

Stephanie Ward
Stephanie Ward Diagram & Visual Documentation Writer

Stephanie spent eight years as a business analyst creating flowcharts, ERDs, and process diagrams for enterprise software teams. She makes diagram creation approachable for teams without a dedicated designer.

More articles by Stephanie →
Launch Your Own Clothing Brand — No Inventory, No Risk