AI ER Diagram Generators Compared
For developers who want an AI tool to draw an ER diagram, either of a new design or of a database that already exists.
On this page
You type "an online shop with customers and orders", and an AI ER diagram generator draws tables, keys and lines. The diagram shows what the AI model predicted from your words. If the database already exists, choose DbSchema. DbSchema connects to the database and reverse-engineers its real tables, keys and constraints into a diagram. Its AI Assistant then writes CREATE TABLE statements that you can merge into the same model.
Eraser, ChartDB, dbdiagram.io, Lucidchart, Miro and Visual Paradigm also turn a prompt into a first diagram of a new design. Every vendor fact below was checked on the vendor's own site on 12 November 2026.
Free Community Edition plus a 15-day Architect trial. No signup. Windows, macOS and Linux.
Where the diagram comes from
An AI ER diagram generator gets its tables from one of two places: your words, or your database.
A prompt-based generator sends your description to an AI model. You can also paste code, such as a SQL schema or an ORM schema. The model then guesses the entities, columns, keys and cardinalities. The diagram can match your prompt exactly and still differ from the database, because the generator never reads the database. Why a chat model can't draw your schema shows the mistakes this leads to.
A reverse-engineered diagram starts from the catalog, where the database describes its own tables. Take two tables in PostgreSQL 18:
CREATE TABLE customers (
id integer PRIMARY KEY,
email text NOT NULL UNIQUE
);
CREATE TABLE orders (
id integer PRIMARY KEY,
customer_id integer NOT NULL REFERENCES customers (id),
status text NOT NULL CHECK (status IN ('open', 'paid', 'shipped'))
);
This query reads their constraints from the catalog, leaving out the NOT NULL ones:
SELECT conrelid::regclass AS table_name,
conname AS constraint_name,
pg_get_constraintdef(oid) AS definition
FROM pg_constraint
WHERE connamespace = 'public'::regnamespace
AND contype <> 'n'
ORDER BY 1, 2;
| table_name | constraint_name | definition |
|---|---|---|
| customers | customers_email_key | UNIQUE (email) |
| customers | customers_pkey | PRIMARY KEY (id) |
| orders | orders_customer_id_fkey | FOREIGN KEY (customer_id) REFERENCES customers(id) |
| orders | orders_pkey | PRIMARY KEY (id) |
| orders | orders_status_check | CHECK ((status = ANY (ARRAY['open'::text, 'paid'::text, 'shipped'::text]))) |
The catalog lists every constraint, including the names that PostgreSQL chose, such as orders_status_check. PostgreSQL stores the CHECK in its own form, not as it was typed. A diagram reverse-engineered from the catalog draws the keys that the database declares. A prompt holds only the keys that you typed into it.
ChartDB and Lucidchart sit between a prompt and a connection. Each gives you a query to run on your database, and you paste its output. The diagram then shows your schema as it was when you ran the query.
The generators compared
DbSchema comes first: it reads the schema through a connection to the database. The tools that import the output of a query come next, then the tools that start from a prompt.
| Tool | The diagram starts from | AI without a paid plan | What you get |
|---|---|---|---|
| DbSchema | A connection to your database, or a question to the AI Assistant | AI trial of two weeks and up to 100 questions, in every edition | The real schema as a diagram; CREATE TABLE statements to merge |
| ChartDB | A prompt, or the output of a query you run on your database | AI Assistant listed on the Team plan only | An editable diagram, and DDL export |
| Lucidchart | A prompt to Lucid AI, or the output of a query you run on your database | Lucid AI included on the Free plan | A diagram, and SQL export without the connections between tables |
| Eraser | A prompt, or pasted code such as a SQL or ORM schema | 3 AI credits and 3 files on the Free plan | Diagram code and its diagram, editable after you sign in |
| dbdiagram.io | A prompt to the AI Assistant | None: the AI Assistant is on the Personal Pro plan | DBML code and its diagram |
| Miro | A prompt, or sticky notes and text on a board | 10 AI credits a month | Editable shapes on a Miro board |
| Visual Paradigm | A description, DBML or SQL CREATE statements | Full access with VP Online Deluxe or VP Desktop Professional | A diagram in OpenDocs, VP Online or VP Desktop |
If you need a diagram of a database that already exists, only the first three rows read the schema from the database, and only DbSchema connects to it. If you are sketching a new design, every row turns a prompt into a first diagram.
DbSchema draws the diagram from your database
DbSchema is a desktop application for Windows, macOS and Linux. DbSchema connects to the database through a JDBC driver, and downloads the driver the first time you connect. The steps are in connect to a database:
- Choose File → New Model.
- Keep Connect to Database selected, and click your database, such as PostgreSQL.
- Choose New Connection, fill in the connection dialog, and press Connect.
- In Reverse Engineer the Database, tick the schemas to import and press Load.
DbSchema draws the imported tables in a new model. The model is DbSchema's own copy of the schema, which you can save as a file. Each foreign key is a line between two tables. Connecting and importing only read from the database and change nothing in it.
MongoDB declares no foreign keys, and MySQL's MyISAM engine ignores foreign keys. For links like these, add a virtual foreign key. DbSchema draws the virtual foreign key on the diagram and never creates it in the database. To keep it, you save the model file, and saving needs DbSchema Pro.
The AI Assistant is a side bar beside the diagram. Select tables on the diagram, right-click one of them and choose Attach to AI. The Ask AI dialog shows what will be sent: the CREATE TABLE statements of those tables, which you can edit.
Ask for a new table, and the answer comes back with SQL in code blocks. Preview shows a CREATE TABLE on a preview diagram. Merge adds the CREATE or ALTER statement to the model. DbSchema sends your question, the conversation and the structure of the attached tables. It never sends table rows, query results, passwords or connection details.
The AI Assistant answers through DbSchema's own AI subscription. The AI trial lasts two weeks, for up to 100 questions, and works in every edition, the free Community Edition included. After the trial, you buy credits. To use your own account at an AI company, such as OpenAI or Anthropic, you need DbSchema Pro or Architect. In AI Settings, you can also choose Ollama, which runs a model on your own computer. Then nothing leaves your computer.
What an AI assistant sees of your database covers the AI Assistant's privacy in more detail.
ChartDB and Lucidchart import the schema from one query
ChartDB runs in the browser, on ChartDB's cloud or on your own server. To import a database, you run one query that ChartDB gives you, copy the JSON result, and paste it into ChartDB. No database password is needed (ChartDB on GitHub). ChartDB's AI ER diagram generator also draws a diagram from a prompt. ChartDB's code is open source under AGPL-3.0. If you host ChartDB yourself, its AI needs your own OpenAI API key, or another endpoint and model.
On ChartDB's cloud, the pricing page lists a free plan of one database with up to 10 tables. It lists the AI Assistant and Auto-Sync on the Team plan.
Lucidchart imports a schema in the same way. In the ERD import, you choose your database system and copy Lucid's query. You run the query on your database, then paste or upload its output. Lucidchart can export the diagram as SQL, except for the connections between tables (Lucid's ERD help). Lucid AI can also generate an ERD from a prompt. Lucid's help lists Lucid AI on the Free, Individual, Team and Enterprise plans, and says it may become a paid subscription.
An imported diagram stays as it was when you ran the query. After a migration, you run the query again and import the new output, or use ChartDB's Auto-Sync on the Team plan.
Eraser and dbdiagram.io write the diagram as code
Eraser's ERD generator takes plain English, a nested list or pasted code. You can paste part of an existing SQL or ORM schema. Generating needs no sign-up. To edit, save or export the diagram, you sign in to a free Eraser account. The diagram is code that you can edit as text or on the canvas. The free plan includes 3 AI credits and 3 files (Eraser pricing).
dbdiagram.io's AI Assistant writes DBML, dbdiagram.io's text format for tables and references, from a chat. It shows a preview of the changes in a diff viewer. The AI Assistant is on the Personal Pro plan.
A chat model such as ChatGPT can be asked for the same kind of text. Mermaid's erDiagram syntax is one target: it marks keys as PK, FK or UK (unique key) and draws crow's foot lines. The model still writes from your words, as every prompt-based generator does.
Miro and Visual Paradigm draw on a board or in a document
Miro's ER diagram AI works on a Miro board. You type a prompt, or select sticky notes and text blocks on the board, and Miro AI proposes an entity-relationship structure as editable shapes. Miro's pricing page gives the free plan 10 AI credits a month.
Visual Paradigm's AI DBML and SQL schema diagram generator is part of its AI chatbot. It takes DBML, SQL CREATE statements or a plain-English description. The diagram can go to OpenDocs, Visual Paradigm's document editor, or to VP Online and VP Desktop. Full access to the generator comes with a VP Online Deluxe or VP Desktop Professional subscription, and a free trial is available.
Draw your own database with DbSchema
Download DbSchema, connect it to your database, and reverse-engineer the schemas into a diagram. Then attach the tables you are changing to the AI Assistant, and ask it for the next CREATE TABLE. The diagram, the SQL editor and the AI trial are in the free Community Edition. Saving the model file and your own AI provider key need DbSchema Pro.
Frequently asked questions
Can AI generate an ER diagram from an existing database?
The prompt-based generators draw from the text you give them. ChartDB and Lucidchart import the output of a query you run on the database. DbSchema connects to the database and reverse-engineers it, then lets its AI Assistant work on the tables you attach.
Is there a free AI ER diagram generator?
Eraser generates a diagram without sign-up, and Miro and Lucidchart include AI on their free plans. DbSchema's free Community Edition reverse-engineers the database into a diagram, and its AI trial covers up to 100 questions.
Sources
- DbSchema: connect to a database, foreign keys and AI Assistant
- ChartDB on GitHub, AI ER diagram generator and pricing
- Lucidchart ERD help and Lucid AI
- Eraser ERD generator and pricing
- dbdiagram.io AI Assistant
- Mermaid erDiagram syntax
- Miro ER diagram AI and pricing
- Visual Paradigm AI DBML and SQL schema diagram generator
Draw the ER diagram from your real database
DbSchema Community Edition connects to your database, reverse-engineers it into an interactive ER diagram and runs the SQL editor, free.