By Tim King · Updated
ER Diagram Maker
Type Relationships as Text for Crow's Foot Diagrams With PK and FK Keys
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the ER Diagram Maker works
This ER diagram maker turns a typed outline of your data into an entity relationship diagram. Write each entity with its attributes indented below, mark keys with PK or FK, then add lines such as "Customer 1-* Order: places". The page draws a box per entity, joins them with crow's foot lines that show how many of each side can relate, and downloads as SVG or PNG.
ER diagram maker: a schema sketch in plain text
An entity relationship diagram shows the things a system stores, the facts stored about each and how they connect. It is the usual first sketch of a database, and a quick way to explain an existing one to a new developer or analyst. Typing it keeps the sketch honest: every relationship is a line you wrote, and changing the model means editing text rather than re-routing lines by hand.
Writing entities and relationships
- A line that is not indented is an entity name, such as "Customer".
- Indented lines below it are its attributes. End one with "PK" for a primary key or "FK" for a foreign key: "customer_id FK".
- A relationship line names two entities with an end marker on each side of a dash: "Customer 1-* Order: places". The text after the colon labels the line.
Ends you can use: "1" for exactly one, "0..1" or "?" for zero or one, "" or "0.." for zero or more, and "1.." or "+" for one or more. Read "Customer 1- Order" as "each order belongs to exactly one customer, and a customer has zero or more orders". An entity named only in a relationship is still drawn, without attributes.
Crow's foot notation
Peter Chen introduced entity relationship modelling in 1976, using diamonds for relationships. The crow's foot style used here, attributed to Gordon Everest, puts the cardinality on the line ends instead and is what most database tools draw today. A three-pronged foot means many, a bar means one and a circle means the relationship is optional on that side.
Checking the model
Many-to-many relationships, counted in the stats, normally need a junction table in a relational database; the sample's OrderLine sits between Order and Product for exactly that reason. Every FK should point at a PK on the related entity. To show how the data moves through an API, add a sequence diagram, and for Mermaid's erDiagram syntax use the Mermaid live editor.
FAQ
How do I show a many-to-many relationship?
Write "*" on both ends, such as "Student - Course: enrols in". The stats count it under Many-to-many. In a real database you would usually replace it with a junction entity, such as Enrolment, that has a one-to-many link to each side.
What do the symbols at the ends of the lines mean?
Two bars mean exactly one. A bar with a circle means zero or one. A crow's foot with a bar means one or more, and a crow's foot with a circle means zero or more. Each end describes how many of that entity relate to one of the other.
Can I import an SQL file?
No. This tool reads its own short text format. Copy table names and columns into it, or write the model before the SQL exists, which is often when an ER diagram is most useful.
Why do lines cross over boxes?
Entities are placed on a grid in the order they are written and lines take a simple route. If a line crosses a box, reorder the entity lines so closely related entities are written next to each other.
See also: all Diagram Makers tools, Images, Audio, Video & Screen, PDF, SVG, Simulations & Screensavers, Generative Art, Chart Makers, 3D Model Viewers, Drawing Pads, Mockups & 3D Making, 3D Science, Tracker Music.
Related tools
Sequence Diagram Maker
Type A -> B message lines and get a sequence diagram.
Mermaid Live Editor
Type Mermaid syntax, preview it live and download SVG or PNG.
Flowchart Maker
Type step -> step lines and download a flowchart as SVG or PNG.
Concept Map Maker
Type concept -> link -> concept lines to draw a concept map.
SVG To PNG
Rasterise an SVG to a PNG at any width.