How to export your data from Railway

Railway has no one-click "export all my data" button. For Postgres databases, the documented way to get your data out is a logical dump with pg_dump (a portable, SQL-level file you create yourself), with scheduled volume backups and point-in-time recovery as Railway-internal safety nets that only restore back into Railway.

Formats: SQL dump (pg_dump custom format, .dump), Plain SQL (pg_dump --format=plain)Plan: Any plan — pg_dump only needs the database connection string available on the Postgres serviceRole: Project member with access to the Postgres service's connection variables

✓ Verified against Railway's official documentation, October 2026

Step by step

  1. 1Open your Railway project and select the Postgres service.
  2. 2Install the Railway CLI and link your local project directory with `railway link`.
  3. 3Open a local tunnel to the database: run `railway connect postgres --tunnel-only`; this prints the host, port, user, password and database for a localhost connection.
  4. 4In a second terminal, run pg_dump against that local tunnel connection string with `--format=custom --no-owner --file=backup-$(date +%Y%m%d-%H%M%S).dump`.
  5. 5Alternative without the CLI tunnel: copy the DATABASE_PUBLIC_URL variable from the Postgres service and run pg_dump directly against it through Railway's public TCP proxy, using the same --format=custom --no-owner --file flags.
  6. 6Optional safety net: on the Postgres service, open the Backups tab and enable scheduled volume backups and/or point-in-time recovery — these restore inside Railway only, not to a downloadable file.
  7. 7Move the resulting .dump file off Railway's infrastructure (e.g., to your laptop or another storage provider) so you have an independent copy.

What the export includes

  • ✓Full schema and data for the Postgres database at the time of the dump (a complete SQL-level copy)

What it doesn't include

  • ✗Application source code, build/start commands, and project config — these live in your connected GitHub repo and Railway project settings, not in the database dump
  • ✗Environment variables — these must be exported separately (e.g., via the Railway CLI) and are not part of a pg_dump
  • ✗Other database engines on Railway (MySQL, Redis, MongoDB) — Railway's published backup/restore guide is Postgres-specific; other engines need their own native dump tool
  • ✗A downloadable copy from volume backups or point-in-time recovery — both restore only to a new/same Postgres service inside Railway, not to a file you can take elsewhere

Before you start

  • ⚠Custom-format dumps (--format=custom) are compressed and allow selective/parallel restores with pg_restore, unlike plain SQL dumps
  • ⚠Point-in-time recovery restores to a brand-new sibling Postgres service, not in place over the original
  • ⚠Volume backups restore only to the same service, project, and environment they came from
  • ⚠You need either the Railway CLI with a tunnel, or the DATABASE_PUBLIC_URL variable, to reach the database from outside Railway — there's no UI button that packages the whole database for download

Where to take your data

Free and cheaper tools that can take a Railway export. See all Railway alternatives →

Render Free

Create a Postgres instance on Render, get its external connection string, and run pg_restore (or psql for plain-format dumps) against it using the .dump file produced from Railway.

Fly.io

Create a Postgres app on Fly, open a proxy with `fly proxy` or use its public connection string, then run pg_restore against it with the Railway-exported .dump file.

Railway Starter

If you're just downsizing plans rather than leaving, spin up a new Postgres service on Railway's free/Hobby trial and run pg_restore against its connection string using the same dump file.

Exporting from Railway: common questions

Does Railway have a built-in button to export my whole database?+

No. Railway's own guide describes the logical dump as something you create yourself with pg_dump, not an automated export feature.

What format is the exported file in?+

Railway's documented approach uses pg_dump with --format=custom, which produces a compressed binary dump that pg_restore can restore selectively or in parallel; plain SQL format is also an option with pg_dump.

Can I restore the dump somewhere other than Railway?+

Yes. Railway's guide explicitly lists logical dumps as restorable anywhere — another Railway service, another provider, or your own laptop.

Do I need the Railway CLI to get my data out?+

No. You can skip the CLI tunnel and run pg_dump directly against the DATABASE_PUBLIC_URL variable through Railway's public TCP proxy.

What's the difference between a volume backup and a pg_dump?+

Volume backups are scheduled/manual snapshots that restore only to the same Postgres service, project and environment, while a pg_dump is a portable SQL-level file you can restore anywhere.

I'm using MySQL/Redis/MongoDB on Railway — does this guide apply?+

Railway's published backup/restore documentation covers Postgres specifically; for other database templates you'd use that engine's own dump tool (e.g., mysqldump, redis-cli --rdb) over the same CLI tunnel approach.

Sources

This guide was written from Railway's own documentation and checked against it in October 2026. If a step has changed, the official page wins.