How to use your own domain for a Minecraft server with an SRV record
A Minecraft server address is usually a hostname plus a port number, which is hard to remember. Add an SRV record to your own domain and players connect with play.yourdomain.com. If you move hosts later, you only change DNS.
A records and SRV records
| Compared | A or CNAME record | SRV record |
|---|---|---|
| Points to | An IP address (A) or a hostname (CNAME) | A hostname and a port |
| Players type | play.example.com:25566 | play.example.com |
| Java Edition | Works | Works |
| Bedrock Edition | Works, port entered separately | Not supported |
If the server uses the default port 25565, an A or CNAME record also lets players skip the port. Rented servers often use a different port, though, and that is where an SRV record comes in.
Java Edition looks up the SRV record first
- play.example.com Server address the player enters
- SRV lookup _minecraft._tcp.play.example.com SRV record name
- Returns mc.example.com Target, port 25565, priority 0, weight 0
Then the target's IP
- mc.example.com SRV target
- A / CNAME lookup 203.0.113.10 IP of mc.example.com
- TCP 25565 203.0.113.10:25565 Connects to the server
Bedrock Edition skips SRV
- play.example.com Address and port go in separate fields
- A / CNAME lookup 203.0.113.10 Uses the port the player entered
Set up SRV in Cloudflare
- Find your server address
It is at the top of the vPanel console and on the Network tab, for example
mc.example.com:25565. The part before the colon is the hostname, and the number after it is the port. - Open Cloudflare DNS
In the Cloudflare dashboard, select your domain, go to DNS and then Records, click Add record, and set the type to SRV.
- Fill in the fields and save
The subdomain in the name is up to you. With play, players connect to play.yourdomain.com.
| Field | What to enter | Example |
|---|---|---|
| Type | SRV | SRV |
| Name | _minecraft._tcp. followed by your subdomain | _minecraft._tcp.play |
| Priority | 0 | 0 |
| Weight | 0 | 0 |
| Port | The number after the colon in the server address | 25565 |
| Target | The hostname before the colon in the server address | mc.example.com |
The SRV target must be a hostname, not an IP. A self-hosted server usually has only an IP, so add an A record first (for example mc.example.com pointing to your IP) with the proxy status set to DNS only, then use mc.example.com as the SRV target. Cloudflare's orange-cloud proxy cannot carry Minecraft traffic.
Test the connection
In Minecraft, open Multiplayer, add a server and enter only play.example.com as the address. If you can join, the record works.
If you can't get in, look up the SRV record from Command Prompt on Windows and check that the target and port in the result are right.
nslookup -type=SRV _minecraft._tcp.play.example.comA record you just changed may not show up yet. Cloudflare usually takes 2 to 5 minutes, and other DNS providers can take a few hours.
Bedrock Edition
Bedrock servers do not support SRV records. Point play.yourdomain.com at the server's hostname with a CNAME record (or at the IP with an A record for a self-hosted server), and set the proxy status to DNS only as well. When players add the server, they enter play.yourdomain.com as the address and fill in the port separately.