Skip to content

Free flowchart, diagram and chart makers

SQL to ER Diagram

Free, no sign-up, nothing uploaded: paste CREATE TABLE statements and your browser reads them and draws the tables, keys and relationships.

Free · runs in your browser · nothing is uploaded

Open on Diagram Smith

This embed was switched off for this website. Open on Diagram Smith

Add this tool to your siteFree embed code, no sign-up. Keep the credit link.

Embed this tool

Copy this code into your website, blog or class page. The tool runs inside your page.

Optional settings, added to the address after embed=1: &accent=0f6b5c (colour, 3 or 6 hex digits). Other parameters are ignored.

Please keep the credit link below the tool.

This free SQL to ER diagram tool turns the structure of a database into a diagram you can read at a glance. Paste your CREATE TABLE and ALTER TABLE statements, or open a .sql, .ddl or .txt file, and the tool draws each table as an entity with its primary keys, unique columns and foreign-key relationships. It runs entirely in your browser, so nothing you paste or open is uploaded to a server, and no account is needed. It reads PostgreSQL, MySQL, SQLite and SQL Server, which makes it a quick database schema diagram generator for a schema you already have.
Sql to er diagram example

How to use the SQL to ER Diagram tool

  1. Paste your SQL into the input box, or open a .sql, .ddl or .txt file. A full schema dump works, because statements other than CREATE TABLE and ALTER TABLE are skipped.
  2. Check the dialect. The tool detects PostgreSQL, MySQL, SQLite or SQL Server from your text. If the detection is wrong, choose the dialect yourself.
  3. Read the diagram. Each table appears as an entity box, and each foreign key becomes a crow’s foot relationship line.
  4. Compare the numbers under the diagram for tables, columns and relationships with your schema. A mismatch tells you a table or key was not read.
  5. If a note appears, read which table or statement it names. Only what it names is left out or needs a check, and the other tables are still drawn.
  6. Click Edit in the ER Diagram Maker to open the diagram there and make changes. Editing there is free.
  7. Export the result as PNG at 1x, 2x or 4x, as SVG, or as a picture PDF. Free exports carry no watermark.

Work autosaves in this browser, and the Saved menu keeps named copies of each version. To share, use a share link, which holds the whole document inside the link. Pro adds larger schemas, up to 40 tables in one diagram, and a .drawio export with real table shapes and relationship lines. The first 400,000 characters of a script are read, and a note says so if there are more.

How does an SQL schema become an ER diagram?

Each CREATE TABLE statement becomes one entity box, and the constraints in it, or in ALTER TABLE statements, become the key markers and relationship lines. The tool reads these declarations directly, so the diagram shows what your database defines, not what someone remembers about it.

SQL elementHow it appears in the diagram
CREATE TABLEOne entity with its columns
PRIMARY KEY (inline or in ALTER TABLE … ADD)Read as the primary key of that table
UNIQUE columnRead as a unique column
FOREIGN KEY (inline or in ALTER TABLE … ADD)Crow’s foot relationship line between the two tables

Each statement is parsed on its own. A table the parser cannot read, for example one with a schema-qualified type, goes to a simpler reader that takes its columns and keys, and a note says which tables. A statement that still cannot be read produces a note, and the rest of the schema still appears. A script with no CREATE TABLE gets a message instead of a diagram. Comments, INSERT rows and other statements in a full dump are skipped, so you do not need to clean the file first. If a foreign key points at a table that is not in the script, a note names it and no line is drawn.

Which command exports a schema from my database?

Run mysqldump –no-data for MySQL, pg_dump –schema-only for PostgreSQL, or sqlite3 .schema for SQLite. Each prints the table structure without the row data, which is all the tool needs.

DatabaseCommandWhat it prints
MySQLmysqldump –no-dataTable definitions, no rows
PostgreSQLpg_dump –schema-onlyTable definitions, no rows
SQLitesqlite3 .schemaCREATE statements for the schema

SQL Server is not covered by these commands, so paste its CREATE TABLE statements directly.

Add your database name and login to each command as usual. These commands print the structure only, so no customer rows or other data are needed. Keep the output in version control next to your code, and you can draw a fresh diagram each time the schema changes.

What this does not do

  • It does not connect to a database. It reads only the text you paste or open, so you export the structure first.
  • It draws tables, keys and relationships. Statements other than CREATE TABLE and ALTER TABLE, such as INSERT rows, are skipped.
  • It reads PostgreSQL, MySQL, SQLite and SQL Server. Free covers up to 5 tables; Pro draws up to 40 in one diagram, and the first 400,000 characters of a script are read, with a note if there is more.
  • A statement it cannot read becomes a note naming it, and that table or key is missing from the diagram.

Frequently asked questions

Is it really free?

The tool is free for schemas of up to 5 tables. Larger schemas need Pro. Results may be used commercially without attribution.

What is an ER diagram?

An entity-relationship diagram shows the things a database stores, such as customers or orders, and how they link together. Lines between the boxes show the relationships, and a crow’s foot marks the “many” end of each link.

Which databases does the tool support?

It supports PostgreSQL, MySQL, SQLite and SQL Server. The dialect is detected from your text, or you can choose it.

What happens to my diagram if I close the tab?

Your work autosaves in this browser, so it is still there when you return. The Saved menu holds named copies if you want to go back to a specific version.

Does my SQL get sent to a server?

No. Nothing connects to a database, and the SQL stays in the browser, which matters when the schema is private.

How do I import a database schema?

You don’t connect to the database. Export the structure with a dump command from the table above, then paste the text or open the file. Only the structure is needed, not the data.

What happens if one statement is invalid?

That statement becomes a note, and the other tables are still drawn. Fix the statement named in the note and paste the script again.

How do you keep a large ER diagram readable?

Group related entities together, use one notation style throughout, and label every relationship with its cardinality. Spreading a big schema across several smaller pastes also keeps each diagram easier to scan.