🗃️ SQL Formatter & Beautifier

Format and beautify SQL queries online. Supports MySQL, PostgreSQL, SQL Server, SQLite. Keyword casing, indent size, and minify mode.

How to Use

1

Paste your SQL

Paste or type your SQL query into the left panel. Single queries, multi-statement scripts, and subqueries are all supported.

2

Choose options

Select the SQL dialect (MySQL, PostgreSQL, SQL Server, or SQLite), indent size, and keyword casing (UPPER or lower).

3

Format and copy

Click Format (or Ctrl+Enter) to beautify the query. Use Minify to compress it. Click Copy to use the result in your project.

Frequently Asked Questions

Does this SQL formatter support stored procedures? +
The formatter handles standard SQL including SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, and JOIN queries. Complex stored procedure syntax with BEGIN/END blocks, IF/ELSE, and DECLARE statements is formatted as best-effort.
What is the difference between beautify and minify? +
Beautify adds line breaks, consistent indentation, and keyword casing for human readability. Minify removes all extra whitespace to produce the smallest possible query string — useful for embedding in code or measuring query length.
Should SQL keywords be uppercase or lowercase? +
Both styles are equally valid — SQL is case-insensitive. The convention of UPPERCASE keywords (SELECT, FROM, WHERE) is traditional and widespread because it visually separates reserved words from table/column names. Many style guides (like Google SQL Style Guide) prefer lowercase for everything.
Does formatting change how the query runs? +
No. Formatting only affects whitespace and keyword case — it has no effect on query execution, performance, or results. The SQL engine ignores whitespace.
Is my SQL query sent to a server? +
No. All formatting runs entirely in your browser using JavaScript. Your SQL code never leaves your device.


Tam Rehber: SQL Formatlayıcı

SQL sorguları bir kez yazılır ancak defalarca okunur. Tutarlı formatlama, anlaşılabilirliği artırır, hataları görünür kılar ve kod incelemelerini hızlandırır.

Neden Formatlama?

Tek satırlık bir sorgu, formatlama sonrası hangi kolonların seçildiğini, hangi tabloların birleştirildiğini ve hangi koşulların uygulandığını hemen ortaya koyar. Görsel incelemeyle yakalanan hatalar, yanlış sonuç döndürdükten sonra fark edilenden çok daha az maliyetlidir.

Diyalekt Farklılıkları

Büyük/Küçük Harf Kuralı

SQL, anahtar sözcük için büyük/küçük harfe duyarsızdır. Geleneksel yaklaşım BÜYÜK HARF (SELECT, FROM) kullanmaktır; bu yöntem anahtar sözcükleri tanımlayıcılardan görsel olarak ayırır. Modern bazı stil rehberleri (Google SQL Stil Rehberi) küçük harf tercih eder. Önemli olan: ekip içinde tutarlılık sağlamak ve bunu bir formatlayıcıyla otomatik uygulamak.

Sorgu sonuçlarını JSON olarak doğrulamak için JSON Formatlayıcı'ya, test verisi üretmek için Mock JSON Üreteci'ne bakın.

🧰 50+ Tools