Railway Custom Domains
Connecting your own domain

Sprout presents
A random Railway subdomain is memorable to approximately zero people. We will attach your own domain, configure DNS, and collect free HTTPS.A random Railway subdomain is memorable to approximately zero people. We will attach your own domain, configure DNS, and collect free HTTPS.

Your app works great at my-app.up.railway.app, but let's be real, nobody's remembering that. Wouldn't your own domain like myawesomeapp.com be nicer? In this lesson you'll connect a custom domain to your Railway app.
What is a Domain Name?#
A domain name is a human-friendly address for a website. You remember a name, and you get to skip memorizing a string of numbers (like an IP address).
google.comis a domain namerailway.appis a domain nameyour-name.comcould be your domain name
When you type a domain into your browser, the internet's phone book (called DNS) looks up the real address and sends you there.
Getting a Domain Name#
Before you can use a custom domain, you have to own one. Here's how.
Step 1. Choose a Domain Registrar#
A registrar is a company that sells domain names. A few popular ones are below.
- Namecheap. Affordable, good interface
- Cloudflare. At-cost pricing, great DNS features
- GoDaddy. Well-known, lots of options
Step 2. Search for Your Domain#
Go to any registrar and search for the name you want. It'll tell you if it's available.
Step 3. Purchase the Domain#
If it's open, add it to your cart and check out. Common endings like .com are pretty cheap per year, and the registrar shows you the exact price (including the renewal price, which can be higher) before you pay.
Step 4. Complete Verification#
The registrar may ask you to verify your email address. You have to do this one.
Understanding DNS#
DNS (Domain Name System) is basically the internet's phone book. It connects domain names to actual server addresses.
When you type myapp.com in your browser, this happens.
- Your browser asks DNS "Where is myapp.com?"
- DNS says "It's at this IP address"
- Your browser goes to that address
To use a custom domain with Railway, you add DNS records that point your domain at Railway.
Types of DNS Records#
You'll mostly work with two kinds.
A Record. Points a domain to an IP address
myapp.com → 123.45.67.89CNAME Record. Points a domain to another domain
www.myapp.com → myapp.up.railway.appRailway uses CNAME records because their IP addresses can change. Your domain points at Railway's domain, and Railway handles the rest.
Adding a Custom Domain on Railway#
Now let's hook your domain up to your Railway app.
Step 1. Open Your Service on Railway#
Go to your Railway project and click your app service.
Step 2. Go to Settings#
Click the "Settings" tab.
Step 3. Find the Domains Section#
Scroll down until you find "Domains" or "Custom Domains."
Step 4. Add Your Domain#
Click "Add Domain" and type in your domain name.
myapp.comStep 5. Copy the DNS Configuration#
Railway will show you a target port to pick (just choose the one your app listens on) and then TWO DNS records you need to add. They'll look something like this.
Type: CNAME
Name: @
Value: g05ns7.up.railway.app
Type: TXT
Name: (Railway shows you this)
Value: (Railway shows you this)The CNAME points your domain at Railway. The TXT record proves you own the domain. You need BOTH, because without the TXT record your domain shows a 404 even when the CNAME is right. Copy that info down.
Configuring DNS at Your Registrar#
Next you tell your domain registrar where to point your domain.
Step 1. Log Into Your Registrar#
Go to the website where you bought your domain and sign in.
Step 2. Find DNS Settings#
Look for "DNS Settings," "Manage DNS," or "Name Servers." Where it lives depends on the registrar.
Step 3. Add the CNAME and TXT Records#
Create a new CNAME record using the values Railway gave you.
- Type. CNAME
- Host/Name. Usually
@for the main domain orwwwfor the www version - Value/Target. The value Railway showed you (like
g05ns7.up.railway.app) - TTL. Leave the default or set it to "Auto"
Then create the TXT record exactly the way Railway shows it.
Step 4. Save Changes#
Click Save. DNS changes take a while to spread across the internet.
Setting Up Both www and Non-www#

Most websites work with both myapp.com and www.myapp.com. Railway counts those as two separate custom domains, and the free trial only allows one (the Hobby plan allows two per service, as of October 2026). So you'll need a paid plan to do both. Here's how.
Add Both Domains in Railway#
In Railway's domain settings, add both versions.
myapp.comwww.myapp.com
Add DNS Records for Both#
At your registrar, create a record for each one.
For myapp.com (root domain), it looks like this.
Type: CNAME (or ALIAS, depends on your DNS provider)
Name: @
Value: [Railway provides this]For www.myapp.com, it looks like this.
Type: CNAME
Name: www
Value: [Railway provides this]SSL Certificates (HTTPS)#
When you visit a site with https://, your connection is encrypted. That takes an SSL certificate. Good news, Railway handles it for you automatically!
Once your domain is connected, here's what happens.
- Railway detects the new domain
- Railway requests an SSL certificate (for free)
- Your site is automatically available over HTTPS
You don't buy a certificate or configure a thing. It just works.
Troubleshooting#
Domain Not Working Yet#
- Check DNS propagation. Use a tool like dnschecker.org to see if your records have spread
- Verify DNS records. Make sure you typed them in correctly at your registrar, and that you added the TXT record too
- Wait. DNS can take up to 72 hours (though it's usually WAY faster)
"Domain Already in Use" Error#
- Someone else may have this domain in Railway
- Make sure you're adding it to the right project
- Contact Railway support if you own the domain but can't add it
HTTPS Not Working#
- SSL certificates can take a few minutes to issue after DNS is set up
- Make sure DNS is set up properly first
- Try clearing your browser cache
Managing Multiple Domains#
You can point a bunch of domains at the same Railway app. That comes in handy for things like these.
- Different regional domains (myapp.com, myapp.co.uk)
- Old domains that redirect to your new one
- Testing with a separate domain
Just add each domain in Railway's settings and set up DNS for each one. Keep in mind your plan limits how many custom domains each service can have.
TL;DR#
- Custom domains make your app look professional
- Buy domains from registrars like Namecheap or Cloudflare
- DNS connects your domain name to Railway's servers
- Railway gives you a CNAME and a TXT record, and you need both
- SSL certificates (HTTPS) are automatic and free
- DNS changes can take up to 72 hours to spread
What's Next?#
Your app is deployed on a real domain now. But how do you know it's actually working right? Next lesson, you'll learn to monitor your app and read logs so you can catch problems and fix them.
This lesson ends with 2 short activities.
