SQLクエリを句ごとに改行・インデントして見やすく整形するか、1行に圧縮(ミニファイ)します。
SQLフォーマッターの使い方
入力欄にSQLクエリを貼り付けます。
「整形」で見やすくするか、「ミニファイ」で1行に圧縮するかを選択します。
キーワードの大文字・小文字を選び、結果をコピーします。
This is a SQL formatter that takes a cramped, single-line or inconsistently styled query and beautifies it: each major clause on its own line, columns and conditions indented, and keyword casing made consistent. It can also do the reverse and minify a query to one line.
Readable SQL is easier to review, debug and maintain. When SELECT, FROM, WHERE, JOIN and GROUP BY each start a new line and the keywords share one casing, the shape of the query, what it returns and how it filters, becomes obvious at a glance.
Formatting is also useful right before committing a query so diffs stay small and reviewers see meaningful changes rather than reflowed whitespace.
You choose the keyword casing (for example uppercase keywords, which is the common convention) and whether to format or minify. The formatter is dialect-agnostic and handles the common ANSI SQL used by PostgreSQL, MySQL, SQLite and SQL Server.
Minify mode is handy for the opposite need: collapsing a formatted query back to a single line to embed in code or a config value.
The tool formats for readability rather than checking that your query is valid, so it will happily lay out a query with a typo in it. Treat clean output as a readability win, not a correctness check.
Everything runs in your browser, which matters because real queries often contain table names, column names and sometimes literal values that hint at your schema or data. None of that is uploaded.
よくある質問
SELECT、FROM、WHERE、JOINなどの主要な句を改行し、列や条件をインデントしてキーワードの大文字・小文字を統一します。
いいえ。整形はブラウザ内で完結するため、クエリがデバイスの外に出ることはありません。テーブル名や列名が含まれていても安全です。
方言に依存せず、PostgreSQL・MySQL・SQLite・SQL Serverで使われる標準的なANSI SQLに対応しています。構文検証ではなく可読性向上を目的としています。
このツールを埋め込む
このツールをご自身のウェブサイトに追加できます。下のコードをコピーしてください。内容は自動的に最新の状態に保たれます。
<iframe src="https://monu.tools/embed/ja/sql-formatter" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>関連ツール