Convert SQL queries to Kysely TypeScript query builder code with type safety and compile-time checks
Zero Dependencies ยท Works OfflineSQL to Kysely is a free online developer tool that automatically converts SQL query statements into Kysely TypeScript query builder code. Kysely is a next-generation type-safe SQL query builder. This tool helps developers quickly migrate existing SQL to Kysely, enjoying TypeScript's type checking and intelligent hints. It supports SELECT, INSERT, UPDATE, DELETE and other common statements, automatically handling JOIN, WHERE, GROUP BY, ORDER BY clauses. All conversion happens locally in the browser โ your SQL data is never uploaded.
1. Paste or type your SQL query in the input area.
2. Select the database type (PostgreSQL/MySQL/SQLite) and code style options.
3. The tool converts in real-time, or click "Convert" to trigger manually.
4. View the generated Kysely TypeScript code in the result area. Copy or download as .ts file.
5. Use Ctrl+Enter to convert, Ctrl+Shift+C to copy results.
Migrate existing raw SQL queries to Kysely for gradual type safety protection, reducing runtime SQL errors.
Developers new to Kysely can input familiar SQL statements to learn the corresponding Kysely API usage.
Convert complex SQL queries to Kysely code for easier code review and version control in TypeScript projects.
Backend developers quickly convert business SQL to Kysely queries for integration with Express/Koa/Fastify APIs.
Kysely is a pure TypeScript SQL query builder developed by Koskimas. Its core advantage is compile-time type checking. It infers database table structures through generics, auto-completing column names and checking types as you write queries. Unlike Prisma, Kysely doesn't generate schema files โ it uses existing database structures directly. Compared to Knex, Kysely provides more complete TypeScript type inference. Best practices: define a Database interface describing table structures, use migrations for schema changes, and pair with kysely-codegen for automatic type generation.
Kysely is a pure TypeScript SQL query builder that provides full type safety, supporting PostgreSQL, MySQL, SQLite and other databases with compile-time SQL error checking.
Supports SELECT (with JOIN/WHERE/GROUP BY/ORDER BY/LIMIT), INSERT, UPDATE, and DELETE statement conversions.
The converted code uses standard Kysely API calls and requires a Kysely instance with database type definitions. We recommend reviewing the output before integrating.
Absolutely. All SQL parsing and code generation happens locally in your browser. No data is ever uploaded to any server.
Kysely is pure TypeScript with full type inference and compile-time checking; Knex is JavaScript-based with weaker type support. Kysely is better suited for TypeScript projects.
Basic subquery conversion is supported, including WHERE clause subqueries and FROM derived tables. Complex nested subqueries may need manual adjustment.
The tool automatically detects SQL table aliases (AS keyword) and uses the corresponding alias methods in Kysely code.