ER Diagram Tool — Generate ER Diagrams from SQL

Paste your CREATE TABLE DDL statements and instantly visualize your database schema as an entity-relationship diagram. Shows tables, columns, primary keys, and foreign key relationships.

CREATE TABLE DDL Input

Paste your CREATE TABLE statements above and click Generate Diagram to visualize your database schema.
Try an example:

What is the ER Diagram Tool?

The ER Diagram Tool turns your CREATE TABLE DDL into a visual entity-relationship diagram. Paste one or more table definitions and the tool parses each table's columns, data types, primary keys, and foreign keys, then draws the schema as an interactive diagram — tables rendered as boxes, relationships as connecting lines. You can zoom in and out, reset the view, and export the result as a PNG image. It supports standard DDL used by MySQL, PostgreSQL, and SQLite, including inline and table-level primary keys, FOREIGN KEY ... REFERENCES, NOT NULL, DEFAULT, UNIQUE, and AUTO_INCREMENT / SERIAL / IDENTITY columns. Everything runs client-side, so your schema never leaves your browser. Primary keys are marked inline, NOT NULL and UNIQUE constraints are reflected in each column's annotation, and every foreign key becomes a labeled relationship line, giving you an at-a-glance map of how your tables connect. A small info bar beneath the canvas reports the number of tables, columns, and foreign keys that were parsed, so you can quickly confirm the tool read your DDL correctly.

How to Generate an ER Diagram

  1. Paste one or more CREATE TABLE statements into the DDL input area.
  2. Optionally load a preset — E-Commerce, Blog, or Library — to see a working example.
  3. Click Generate Diagram.
  4. Use Zoom +, Zoom -, and Reset to navigate the diagram.
  5. Click Export PNG to download the diagram as an image for documentation or sharing.

Common Use Cases

Example: Two Related Tables

Pasting the following DDL draws two tables connected by a foreign key:

CREATE TABLE users ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(100) NOT NULL, email VARCHAR(255) UNIQUE NOT NULL ); CREATE TABLE orders ( id INT PRIMARY KEY AUTO_INCREMENT, user_id INT NOT NULL, total DECIMAL(10,2) NOT NULL, FOREIGN KEY (user_id) REFERENCES users(id) );

The diagram shows a users box and an orders box, with the id columns marked as primary keys and a relationship line drawn from orders.user_id to users.id. Column data types and the NOT NULL and UNIQUE flags appear under each column name, so you can review constraints without reopening the raw DDL.

Tips for Cleaner ER Diagrams

Keep your DDL focused on CREATE TABLE blocks — the parser ignores comments and ALTER TABLE lines, so you can safely paste an entire schema dump. Use consistent naming for primary and foreign key columns to make relationships easier to read. For large schemas, generate the diagram in sections (a few related tables at a time) so the layout stays legible, and export each section to PNG before moving on. Exporting at a higher zoom level produces a sharper image, so zoom in before you download if you plan to embed the diagram in a document or slide deck.

SQL to ER Diagram: From CREATE TABLE to a Database Diagram

Any schema you can express as CREATE TABLE statements converts into a diagram in a single paste. The only real work is getting the DDL out of your database, and every major engine ships a command for it:

-- MySQL: dump the schema only, no data mysqldump --no-data --skip-comments mydb > schema.sql -- Or grab one table definition SHOW CREATE TABLE orders;
-- PostgreSQL: schema only, no owner or privilege noise pg_dump --schema-only --no-owner --no-privileges mydb > schema.sql
-- SQLite: print the full schema sqlite3 app.db .schema > schema.sql -- SQL Server: Tasks > Generate Scripts, or read INFORMATION_SCHEMA

Paste the output straight into the input box and click Generate Diagram. You do not need to clean the dump first: the parser reads CREATE TABLE blocks and skips INSERT statements, ALTER TABLE patches, comments, and the SET pragmas a dump wraps around them. That means a full mysqldump or pg_dump file works as-is.

Two things determine how readable the result is. First, foreign keys: if your schema declares FOREIGN KEY ... REFERENCES, every relationship is drawn as a line. Schemas generated by some ORMs and all junction tables without an explicit FK constraint will render as isolated boxes — add the missing constraint to the DDL (or at least name the columns consistently, like user_id pointing at users.id) and regenerate, and the relationships appear. Second, scope: paste the tables that belong to one module rather than the whole database, and the automatic layout stays legible.

Database Diagram vs ER Diagram vs Schema Diagram

The same feature gets searched under several names, and they are not quite identical:

Because this tool parses CREATE TABLE declarations, what it draws is a physical database diagram: a box per table, a row per column with its data type and constraints, and a line per foreign key. That is the version that has to match your code, and it doubles as an ER diagram for design discussions. If you specifically need a Chen-style conceptual model with diamonds and ovals, sketch it from this diagram — the physical view is the one that stays true as the schema changes.

Online Database Diagram Maker vs Desktop Tools

MySQL Workbench, pgAdmin, DBeaver, and SQL Server Management Studio can all reverse-engineer a diagram from a live connection, and for day-to-day work inside one engine they are excellent. A browser-based diagram maker wins in four situations:

Desktop tools remain the better choice when you want live introspection across hundreds of tables, schema editing, or forward engineering from a model. There is also a security argument on both sides: here nothing is uploaded, because the parsing and rendering happen in your browser — which also means you never type production credentials into a web page. See the free online ER diagram generator guide for the longer walkthrough. Once the relationships are clear, generate test data for the tables, convert the schema between dialects, or check the query plans that hit those tables with the EXPLAIN visualizer.

Frequently Asked Questions

How do I create an ER diagram from SQL?

Paste one or more CREATE TABLE statements into the DDL input area and click Generate Diagram. The tool parses each table's columns, data types, primary keys, and foreign keys, then draws tables as boxes and relationships as connecting lines. Everything runs in your browser, so nothing is uploaded.

Can I turn a SQL dump into a database diagram without installing anything?

Yes. The tool only needs the DDL text, so mysqldump --no-data, pg_dump --schema-only, and sqlite3 .schema output can be pasted as-is. INSERT statements, comments, ALTER TABLE patches, and dump pragmas are ignored rather than treated as errors.

What is the difference between an ER diagram and a database diagram?

An ER diagram is a conceptual model of entities and relationships; a database diagram is the physical model that adds column names, data types, and key constraints. Since this tool works from DDL, it produces the physical diagram and still shows every foreign key as a relationship line.

Does it work with MySQL, PostgreSQL, and SQLite schemas?

Yes. The parser handles standard CREATE TABLE syntax from MySQL, PostgreSQL, SQLite, SQL Server, and most other relational databases, including inline and table-level PRIMARY KEY, FOREIGN KEY ... REFERENCES, NOT NULL, DEFAULT, UNIQUE, and AUTO_INCREMENT or SERIAL columns.

Can I export or download the diagram?

Click Export PNG to download the current diagram as a PNG image; zoom in first if you plan to embed it in a document or slide. Zoom +, Zoom -, and Reset control the view, and the diagram renders on an HTML canvas so the export stays crisp.

How many tables can it handle?

A few dozen tables render comfortably in one pass. For very large schemas, generate the diagram in sections — one module or feature area at a time — and export each PNG, which also keeps the automatic layout readable.

Can I convert an ER diagram back into SQL?

Not from a picture: the tool reads DDL, it does not import images. If you have a hand-drawn ER model, write the CREATE TABLE statements with their PRIMARY KEY and FOREIGN KEY clauses and paste them — the generated diagram then acts as a visual check that the DDL matches your model.

Is my schema data safe when I generate a diagram?

Yes. All DDL parsing and rendering happens client-side in JavaScript. Your schema definitions never leave your device — no server-side processing, no logging, and no data collection.

Do I need an account or a signup?

No. The tool is free, requires no registration, and has no usage limit on how many schemas you diagram.

More SQL Tools

SQL Formatter· SQL Diff· EXPLAIN Visualizer· Data Generator· Dialect Converter· ER Diagram Guide