DBML to SQL converter
Convert DBML Table blocks and Refs to PostgreSQL DDL, or SQL back to DBML, in one click. Free, instant, runs entirely in your browser.
Table users {
id uuid [pk, default: `gen_random_uuid()`]
email text [not null]
name text
created_at timestamptz [not null, default: `now()`]
}
Table posts {
id uuid [pk, default: `gen_random_uuid()`]
author_id uuid [not null]
title text [not null]
published boolean [not null, default: `false`]
}
Ref: posts.author_id > users.id
Frequently asked questions
What is DBML and how is it different from SQL DDL?
DBML (Database Markup Language) is a compact human-readable format for defining schemas, Table blocks with columns and Ref lines for relationships. SQL DDL is what the database actually executes. DBML is shorter to write by hand; DDL is what you run. This tool converts both ways so design docs and migrations stay in sync.
Is it free?
Yes, completely free with no signup. Both directions convert instantly in your browser, Table and Enum blocks, column settings, and Ref lines included.
Is my schema uploaded anywhere?
No. Parsing and generation run entirely in your browser with zero dependencies. Your schema is never uploaded, stored, or logged.
Which DBML features are supported?
Table blocks with column types and settings (pk, not null, unique, default), single-line and block Refs in all three directions (>, <, -), and Enum blocks. Project headers, TableGroups, and indexes blocks are ignored for the diagram-relevant output.
Can I turn the result into an ER diagram?
Yes. Click Visualize this schema to open the converted SQL in dbdiagramr as an interactive ER diagram, useful for checking a hand-written DBML design before generating migrations.
Related tools
Turn it into an ER diagram
Paste your PostgreSQL connection string and get an interactive ER diagram of your own schema in under 10 seconds. No signup required.