SQL DDL to TypeScript Converter

Convert SQL CREATE TABLE statements to TypeScript interfaces. Maps SQL types to TS types, handles nullable columns, arrays, JSON, and UUIDs.

Your data never leaves your browser Available via MCP

How to Use

  1. Paste your SQL CREATE TABLE statements into the left panel.
  2. Optionally toggle Optional for nullable fields to use ? syntax.
  3. Click Convert to TypeScript.
  4. Copy the generated interfaces with the Copy button.

Type Mapping Reference

  • INT, SERIAL, BIGINT, FLOAT, DECIMALnumber
  • VARCHAR, TEXT, CHAR, UUIDstring
  • BOOLEAN, BOOLboolean
  • TIMESTAMP, DATE, DATETIMEDate
  • JSON, JSONBRecord<string, unknown>
  • BYTEA, BLOBBuffer
  • TEXT[]string[]

Related Tools

Format SQL queries with the SQL Formatter. Convert SQL to MongoDB with SQL to NoSQL. Generate TypeScript from JSON with JSON to TypeScript. Generate TypeScript from OpenAPI specs with OpenAPI to TypeScript. Generate JSON schemas with the JSON Schema Generator.

Frequently Asked Questions

What SQL dialects are supported?
This tool parses standard CREATE TABLE statements compatible with PostgreSQL, MySQL, SQLite, and SQL Server. It handles column types, NOT NULL constraints, and DEFAULT values.
How are SQL types mapped to TypeScript?
INT/SERIAL → number, VARCHAR/TEXT → string, BOOLEAN → boolean, TIMESTAMP/DATE → Date, JSONB → Record<string, unknown>, BYTEA/BLOB → Buffer, UUID → string, and arrays like TEXT[] → string[].
How are nullable columns handled?
By default, nullable columns get "| null" added to their type. You can toggle "Optional for nullable fields" to use "?" instead, which is better for insert types where you want to omit nullable fields.
Is my data safe?
Yes. All SQL parsing and TypeScript generation happens entirely in your browser. No data is sent to any server.

Use this tool from AI agents. The CodeTidy MCP Server lets Claude, Cursor, and other AI agents use this tool and 46 others directly. One command: npx @codetidy/mcp

Drop file to load