SQL to PDF
Convert SQL to a clean, printable PDF with selectable text.
Your SQL queries and schema files are formatted into a printable PDF locally in your browser without server uploads. See our privacy policy.
Your SQL queries and schema files are formatted into a printable PDF locally in your browser without server uploads. See our privacy policy.
Your SQL queries and schema files are formatted into a printable PDF locally in your browser without server uploads. See our privacy policy.
How to convert SQL to PDF
- Paste your SQL script into the text area or click Choose a file to load a local
.sqlfile. - Select A4 or US Letter page size.
- Click Make PDF and then Save PDF to download the document.
Database administrators, backend engineers, and data students frequently need to submit SQL schema migrations (`CREATE TABLE`, `ALTER TABLE`), complex analytical queries (`WITH ... SELECT ... JOIN`), or stored procedures to change-advisory boards (CAB), university grading portals, or security compliance tickets that only accept .pdf files. This converter typesets your SQL statements in a fixed-width Courier font with all indentation, SQL comments (-- and /* */), and line breaks preserved as real selectable text.
Worked example: Printing a PostgreSQL migration script (.sql) to A4 PDF for change review
Suppose you wrote a 95-line PostgreSQL schema migration named V20261114__add_settlement_ledger.sql (3.8 KB):
BEGIN;
CREATE TABLE IF NOT EXISTS settlement_ledger (
ledger_id UUID PRIMARY KEY,
account_id BIGINT NOT NULL REFERENCES accounts(id),
amount_cents BIGINT NOT NULL CHECK (amount_cents >= 0),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX idx_settlement_account ON settlement_ledger (account_id, created_at DESC);
COMMIT;
If your query is unformatted or cramped onto a single line, run it through the SQL Formatter first. Pasting the 95-line script here and selecting A4 generates a 2-page PDF (15.2 KB) where column definitions align vertically and reviewers can copy individual `CREATE INDEX` statements directly out of the PDF.
Limits and what this tool cannot do
- Does not execute SQL or render query result tables: This tool prints the text of your SQL code into a PDF; it does not connect to a database, run `SELECT` queries, or render `INSERT` dump rows as a spreadsheet table.
- Do not load multi-gigabyte database dumps (`pg_dump` / `mysqldump`): A 500 MB SQL dump containing millions of `INSERT` statements would generate hundreds of thousands of PDF pages and exhaust browser memory. Use this tool for schema scripts, queries, and readable migrations (up to a few thousand lines).
- Standard Latin font encoding: Built-in PDF Courier fonts support ASCII and Western European characters (WinAnsiEncoding); non-Latin characters in string literals are shown as
?and counted in the summary notice.
Questions
Does this tool connect to my database or upload my schema?
No. Everything runs offline inside your browser tab. Your table names, column definitions, and SQL queries never leave your computer.
What if my SQL query is one long unindented line?
Open the SQL Formatter tool on this site first to automatically break clauses (SELECT, FROM, WHERE, GROUP BY) onto indented lines, then paste the formatted SQL here.
Can I copy and paste SQL queries out of the generated PDF?
Yes. Because the PDF uses native text streams in the standard Courier font rather than scanned images, anyone viewing the PDF can highlight and copy the SQL text.
Does the PDF include syntax highlighting colors?
No. The SQL is set in high-contrast black Courier text on a white page so it prints cleanly on both monochrome laser printers and screen readers.