Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to use a Custom Domain with Replit

Using a Custom Domain with Replit


Do you dislike your long repl.co domain? Or, do you want a more memorable one? Well, whatever the reason, this tutorial is for you!

There are many tutorials for this, but most of them are outdated and no longer work.
So, I thought I would create my own accurate tutorial!

Let's get started!

Creating your Repl

Well, I'll assume you already have a repl that hosts a web application.

  • If you are in a team, you must be the owner of the team to do this!
  • For a multiplayer repl, you need to be the owner of the repl

So, onto the next step!

Getting a Domain

Well, you obviously need a domain to add a custom domain to your repl!
For this tutorial, I'll be getting a free domain from Freenom, but you can get yours from anywhere.

Choosing your Domain

We're going to be getting a domain from Freenom.

Search for a domain you would like and click Get it now!, then Checkout Freenom is very slow to load. Be patient

If you can't use the Get it now! button, search for the domain with the extension on the end.

"Buy" your domain

Select the period you would like from the PERIOD dropdown. I recommend 12 months @ FREE if you want it for free. Then, click Continue. Now, complete your order after agreeing to the Terms and Conditions.

If you have never used Freenom before, you will be asked to create an account. Do this, and I'll see you on the next step.

Managing Domains

You can manage all of your domains under My Domains

Now, select your domain.

Setting up your Domain with Cloudflare

Now, we'll add our domain to Cloudlfare. You don't have to do this, though your website will be faster and more secure if you do do this. And it's free, so why not?

So, create or sign into a Cloudflare account.

Adding our site to Cloudflare

Now, we need to tell Cloudlflare what our domain is, and prove that it is ours.

Now, select a plan. I'll use Free.

It will scan for DNS records, and now is the time to link our domain to our repl.

Linking to your Repl

Go back to your repl. Click the pencil icon on the web preview and enter your domain.

Replit will give you a CNAME record. Copy that, because we will need it for the next step.

Go ahead and press Next

Make sure you keep the repl open or the linking process will stop.

Adding CNAME

Add a new record with the type being CNAME, the name being @ and the target is what you copied from Replit.

Changing nameservers

The penultimate step is here. We need to change our domain's nameservers for use with Cloudflare.

The nameservers you are given are random, and won't be the same every time. So, don't copy my ones, or ones that you have had in the past.

Now, link your domain on Replit.

Changing Security

The final thing to do is to change some Cloudflare security settings. You won't be able to access your website if you don't do this.

Go through the Quick Start Guide turning everything On This isn't necessary, but it provides a better experience to the visitors of your website.

Now, you need to go to SSL and select Full(Strict)


We're all finished setting up our domain now. Head over to your URL, and give it a go!

I have been using this repl: @DillonB07/Custom-Domain-Demo and this domain: https://customdomaindemo.ml

I hope this tutorial was helpful. If you have any questions or issues, please leave them in the comments, and I'll reply as soon as I can.
If you have a suggestion for another post like this, also leave it in the comments, and I'll try and make it!


Great tutorial, just one thing:

So, create or sign into a Cloudflare (link has typo) account.


Thanks @MystPi Fixed it.




By the way, .tk domains do work on Cloudflare, I have a .tk domain on there. :p


Thanks for the info, I'll update the post.


My linking takes more than 48 hours and doesn't connect, could I have a little bit of help with that?


@notrouchys Double check that the name servers have updated on Freenom. If they are correct, then check that the CNAME on Cloudflare is correct. If it still doesn't work, make sure that you've put the domain in correctly on your repl's Link Domain option.


@DillonB07 Yep, I am sure about all the above, and im not using Freenom, I have bought a domain from hostinger, and am using it with cloudflare, and I have the CNAME set!


@notrouchys I'm not sure then.
If it's just not loading in the repl, open it in a new tab/window because it doesn't work on the Replit tab sometimes.

What is your domain? I'll see if it works for me.


@DillonB07 My domain is " www.kazoobot.xyz " and my repl.it domain is " https://kazoo.notrouchys.repl.co " I let it run for 20 hours yesterday and my pc shut down so it stopped, it has been running for another 8 hours now, just loading..
( my website just went down for some reason.. )


@notrouchys I assume it went down because if you aren't using the repl or site it will turn off after one hour.

But yeah, the domain is weird.
Try contacting Replit by using the question mark at the bottom left of replit.


@DillonB07 No no, not my repl.it, that has been up for 5 days except for me turning it off to add more commands or something, but it has ran for days straight, the domain shut down with error 522!


@notrouchys Oh hang on. I think I know what's wrong.

In Cloudflare what did you put as the CNAME target? @ or www?

If you put @ don't include www in Replit linking or the address.


@DillonB07 I've tried to add both, but I have set " @ " for root..


@notrouchys There must be an issue somewhere then. Could you take a screenshot of the Cloudflare records?



I dont know if this is what you need, im not too fond with cloudflare!


@notrouchys On the bar at the top select DNS and take a screenshot of the records.



on cloudflare it says " www " but on hostinger I had set it as " @ " but I have tried to connect with " www / without " so that doesn't really matter..


@notrouchys You've done your CNAME wrong. It shouldn't have kazoobot.xyz as the content. Try replacing it with this: https://c91d0624-8fea-448c-96a2-296bc3157306.id.repl.co/ Then, relink with www.


@DillonB07 I dont know where it is linked, but it is read the bottom, I'm pretty confused about this too..


oh my god, I just deleted the www one, and added this, and it said that it is configured correctly, I feel stupid..


@notrouchys Don't feel stupid! I make mistakes all the time and feel stupid for not realising it. It's human! Also, with that many records it's quite easy to get something wrong.

Anyway glad you've sorted it!


@DillonB07 Yes, thank you very much for the help, without it, I would still be waiting on the loading part, haha!


@notrouchys No problem!


@DillonB07 I saw ~and replied to~ your deleted message. I saw you fixed it, so could you tell me how to do it? I've not figured it out myself.


@DillonB07 Oh, okay, so.. I went to cloudflare, went over to the tab " Rules " and then added a permanent redirect from " kazoobot.xyz " to " www.kazoobot.xyz " like this


@notrouchys Thanks! According to Cloudflare, I created a community post before you deleted the message, if you set it up like this, the paths will be kept as well! For example, www.kazoobot.xyz/dashboard works, but kazoobot.xyz/dashboard doesn't.
Add a * after the / in the first box, and a /$1 at the end of the last box.


@DillonB07 Oh, I dont have them added, but both " www. / no www. " work well, all good tho, thanks for the information!