Adding a custom domain

With Surge, you can use your own domain in place of a subdomain. This means you’ll be able to publish to

Setting a CNAME

To get started, you’ll need have a custom domain and sign into your account to manage it. now:

  1. Add a new CNAME record to your domain.
  2. Set the hostnames @ and www to:

    Depending on your domain provider, it will look something like this:

    How to add an CNAME record on NameCheap.

    If your DNS provider doesn’t support CNAME records for apex domains, you can set an A record to the following IP address instead:
  3. Additionally, setting the hostname * to will allow you to deploy to custom subdomains on your domain as well.

    Adding a CNAME record for * allows you to deploy to subdomains on your own domain, like

Instructions from your DNS provider

More detailed instructions are available directly from your domain provider:

Surge will be ready to use the domain right away, but it may take longer to propagate everywhere, depending on the internet service provider.

Deploying to your custom domain

Now you’re ready to deploy your project to your custom domain. With the Surge command line tool installed, you could run the follwing command:

surge path/to/my-project

Saving a custom domain

You can save your custom domain so you don’t have to type it in each time you deploy. Simply add a CNAME file (no extension) to the root of the project you’re deploying, and Surge will use that automatically.

You can create a new CNAME using the following command:

echo > CNAME