How to export your data from Heroku
Heroku doesn't export "workspace" data like a SaaS app — the main thing to export is your Heroku Postgres database, using the pg:backups CLI tool (a wrapper around pg_dump) to produce a compressed custom-format dump, or raw pg_dump for plain-text/partial exports.
✓ Verified against Heroku's official documentation, October 2026
Step by step
- 1Install/update the Heroku CLI and run `heroku login`.
- 2Capture a fresh logical backup: `heroku pg:backups:capture --app example-app` (backs up the database attached as DATABASE_URL by default).
- 3Download the backup to your machine: `heroku pg:backups:download --app example-app`.
- 4If you have multiple Postgres add-ons on the app, repeat capture/download for each by name, e.g. `heroku pg:backups:capture HEROKU_POSTGRESQL_PINK --app example-app`.
- 5For a partial export (specific tables/schemas) or a plain-text dump instead of the default custom format, run pg_dump directly against the connection string, e.g. `pg_dump -Fp --no-acl --no-owner <DATABASE_CONNECTION_STRING> > mydb.dump`.
- 6To verify or reuse the data locally, restore it with `pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump`.
- 7Check `heroku pg:backups:info` for progress/status, and `heroku pg:backups` to list what you have before deleting any add-on.
What the export includes
- ✓Full schema and data of the targeted Postgres database at the moment of capture
- ✓Specific tables/schemas only, if you use pg_dump with --table or --schema flags instead of the default full capture
What it doesn't include
- ✗App source code, buildpacks, or release/slug data (not part of a Postgres backup)
- ✗Config vars, add-on configuration, or other attached services/add-ons
- ✗Indexes themselves — pg_dump backups contain the live dataset and instructions to remake indexes, not the indexes
- ✗Databases larger than ~20 GB reliably — PGBackups is only intended for moderately loaded databases up to that size
Before you start
- ⚠Manual backup retention is capped by plan: Essential-* keeps 5, Standard-* keeps 25, Premium-* and Enterprise keep 50 — once you hit the limit, capturing a new backup auto-deletes the oldest one.
- ⚠PGBackups isn't supported on Heroku Postgres Advanced (Limited GA) plans.
- ⚠For databases over 20 GB or under heavy load, PGBackups can time out — Heroku's docs point to a separate 'Capturing Logical Backups on Larger Databases' process using a short-lived fork plus manual pg_dump.
- ⚠Capturing a backup adds load to the live database for the duration of the capture; consider running it against a follower if that's a concern.
- ⚠Restoring a backup into an existing Heroku Postgres database deletes that database's existing content first.
- ⚠Old pg_restore versions can throw an 'unsupported version' error — make sure your local pg_restore is up to date before restoring.
Where to take your data
Free and cheaper tools that can take a Heroku export. See all Heroku alternatives →
Provision a Postgres database on Railway, grab its connection string, and run pg_restore (or psql for plain-text dumps) pointed at that connection string to load your Heroku-exported dump.
Render
Create a Postgres instance on Render, then use pg_restore with Render's external connection string to load the custom-format dump you downloaded from Heroku.
Fly.io
Launch a Postgres app on Fly.io, proxy/connect to it, and run pg_restore against its connection string using the dump file downloaded via `heroku pg:backups:download`.
Exporting from Heroku: common questions
What format is a Heroku Postgres backup in?+
By default it's a compressed custom-format pg_dump archive, restorable with pg_restore. You can also generate a plain-text SQL dump yourself with `pg_dump -Fp`.
Can I export only specific tables instead of the whole database?+
Yes — run pg_dump directly against your database connection string with --table or --schema flags instead of using the default `pg:backups:capture`.
How many backups can Heroku keep before deleting old ones?+
It depends on your plan: 5 for Essential, 25 for Standard, and 50 for Premium or Enterprise. Hitting the limit auto-deletes the oldest manual backup on your next capture.
Will my 25 GB+ production database export cleanly?+
Not reliably with the standard pg:backups command — Heroku's docs say PGBackups is meant for databases up to 20 GB and recommends a separate large-database backup process (fork + manual pg_dump) above that.
If I restore my Heroku backup into a new database, does it merge with existing data?+
No. Restoring into an existing Heroku Postgres database deletes that database's existing content before loading the backup.
Can I restore a Heroku Postgres dump on a non-Heroku host?+
Yes — the dump is a standard pg_dump/pg_restore-compatible file, so it can be restored to any Postgres instance, including ones on Railway, Render, or Fly.io.
Sources
This guide was written from Heroku's own documentation and checked against it in October 2026. If a step has changed, the official page wins.
Heroku head-to-head
More Dev Tools tools people are leaving
All Dev Tools alternatives →What would you save without Heroku?
Pick your team size and see the yearly number.