Free PostgreSQL exporter — no upload, no account

Export PostgreSQL to CSV
Dump files or
psql output.

Free PostgreSQL to CSV converter. Upload a pg_dump .sql file or paste psql query output — aligned table, pipe-separated or CSV format. Handles standard SQL quoting and all psql output modes. Runs in your browser.

Your data never leaves your browser
pg_dump parser
All psql output formats
Copy to clipboard
Always free
PostgreSQL to CSV Converter  100% client-side
Drop your pg_dump .sql file here
INSERT statements with double-quote identifiers parsed automatically
Paste psql query output
 Export complete

      
Native PostgreSQL CSV export commands

Use these when you have direct database access — faster and simpler than this tool for large exports.

\copy — client-side, works with any remote database
\copy table TO 'output.csv' WITH (FORMAT csv, HEADER true); -- With a custom query: \copy (SELECT id, name, email FROM users WHERE active = true) TO 'users.csv' CSV HEADER;
Run in psql. The leading \ means psql writes to a file on YOUR machine, not the server — works with RDS, Supabase, Neon, Render and any remote PostgreSQL host.
psql one-liner — export from command line
psql -U username -d database \ -c "\copy (SELECT * FROM table) TO STDOUT CSV HEADER" \ > output.csv
Pipes COPY output directly to a local file. Add -h host -p port for remote connections. Produces clean CSV ready for Excel, Google Sheets or any ETL tool.
\pset format csv — inline CSV output in psql session
\pset format csv \pset tuples_only on SELECT * FROM your_table; \pset format aligned -- revert to default
Switches psql to output CSV directly in the terminal. Copy the output and paste into CSVShift's CLI mode, or redirect to a file with psql -o output.csv.
How to export PostgreSQL to CSV

Two input modes — pick what you have available.

1
pg_dump file mode

Upload a .sql file generated by pg_dump. CSVShift parses INSERT statements with PostgreSQL's standard quoting — double-quote identifiers, '' escaped strings, BOOLEAN values and NULL. Each row in the INSERT becomes a CSV row.

2
psql CLI output mode

Copy output from any psql format and paste it here. CSVShift auto-detects the format: aligned table (default, with col | col2 and ----+---- separators), unaligned (-A flag), CSV output (\pset format csv), or tab-separated (-F '\t'). Footer lines like "(2 rows)" are stripped automatically.

3
Download RFC 4180 CSV

Download the resulting CSV with UTF-8 BOM encoding, or copy to clipboard. Opens correctly in Excel, Google Sheets and any database import tool without encoding issues.

When do you need to export PostgreSQL to CSV?

Common situations where a CSV export is necessary.

Data analysis in Excel or Sheets

PostgreSQL query results that need pivot tables, charts or manual review in a spreadsheet — paste the psql output directly into CSVShift for instant conversion without needing server file access.

Database migration

Exporting a PostgreSQL table as CSV for re-import into MySQL, SQLite or another system. CSV avoids SQL dialect incompatibilities in direct dump conversion.

Sharing data without DB access

Paste query output from a psql session, convert to CSV here, and share the spreadsheet with non-technical stakeholders who don't have database credentials.

pg_dump backup analysis

Analyse a PostgreSQL backup's INSERT data in Excel to verify data integrity, check row counts, or audit specific values — without needing to restore the database.

Related CSV tools

Other free converters on CSVShift you might need.

Popular searches
postgres export to csv psql copy to csv copy psql to csv export from postgres to csv postgresql copy to csv postgres output to csv copy postgres query to csv dump postgres table to csv psql output csv format postgresql export table to csv psql save query to csv how to export postgresql to csv

PostgreSQL data parsed
in your browser. No upload.

CSVShift parses pg_dump files and psql output entirely in JavaScript. Your database data is never transmitted to any server. The parser handles PostgreSQL's standard SQL string escaping ('' not backslash) and correctly identifies NULL, BOOLEAN, NUMERIC and TEXT values.

4 psql output formats
Aligned table (default), pipe-unaligned (-A), CSV (\pset format csv) and tab-separated — all auto-detected.
Standard SQL quoting
Correctly handles '' string escaping and double-quote identifiers — PostgreSQL and ANSI SQL compliant.
Footer stripping
"(N rows)" and "Time: X ms" psql footers are automatically removed from the output.
Free, no conditions
No file size limit, no watermark, no account. Funded by display advertising only.
Frequently asked questions
Common questions about exporting PostgreSQL data to CSV.
How do I export PostgreSQL to CSV?
In psql: \copy table TO 'file.csv' WITH (FORMAT csv, HEADER true); — writes to your local machine. For a browser-based option, run the query in psql, copy the output, switch to CLI Output mode in CSVShift and paste it.
How do I use \copy in psql to export CSV?
\copy (SELECT * FROM table) TO '/local/path/file.csv' WITH (FORMAT csv, HEADER true); — the backslash \copy writes to the file on your local machine, not the PostgreSQL server. Works with any remote or cloud PostgreSQL instance without needing server file system access.
How do I export a PostgreSQL query to CSV?
Wrap the query in a \copy subselect: \copy (SELECT col1, col2 FROM table WHERE condition ORDER BY col1) TO 'file.csv' CSV HEADER;. Any valid SELECT query works as the source. Alternatively, use \pset format csv then run the query to get CSV output in the terminal.
How do I convert a pg_dump file to CSV?
Upload your pg_dump .sql file in CSVShift's dump mode. The tool parses every INSERT INTO statement — handling double-quote identifiers and PostgreSQL's '' string escaping — and exports each row as a CSV record. Works with single-table and multi-table dump files.
Is my data safe when converting PostgreSQL to CSV online?
Yes. CSVShift processes everything in your browser. Your pg_dump file and any pasted query output are never transmitted to any server. Open the Network inspector during conversion — zero outbound data requests are made.