A domain is easier to remember than an IP address and port, and you can move servers later without telling everyone a new address.
1 Get a domain
Buy a domain from any registrar, or use one you already own. You’ll add records to it, so you need access to its DNS settings.
2 Find your server’s address
In the console, note your server’s IP address and port, for example 203.0.113.10:25570.
3 Add an A record
Create an A record named play that points to your server’s IP address:
play.example.com. 3600 IN A 203.0.113.10
4 Add an SRV record for the port
If your port isn’t the default 25565, add an SRV record so players don’t have to type it. Service _minecraft, protocol _tcp, name play, priority 0, weight 5, your port, and the target from step 3:
_minecraft._tcp.play.example.com. 3600 IN SRV 0 5 25570 play.example.com.
5 Wait, then join
DNS changes usually show up within minutes, sometimes a few hours. Then join with just play.example.com.
Using Cloudflare? Set these records to DNS only (grey cloud). Cloudflare’s proxy doesn’t carry Minecraft traffic. SRV records work for Java Edition; Bedrock players still enter the port.