To set up an apex domain, such as example.com, you must configure an ALIAS, ANAME, or A record with your DNS provider.

Tip: If you have trouble configuring an ALIAS, ANAME or A record, then contact your DNS provider for help. They can help confirm that you have configured your custom domain correctly with their services.

Warning: Unless your DNS provider supports CNAME flattening, don't create a CNAME record for your custom apex domain. Doing so may cause issues with other services, such as email, on that domain.

For more information on apex domains, see "About supported custom domains."

To determine which type of DNS record to configure with your DNS provider, check if your DNS provider supports ALIAS or ANAME records. We recommend configuring your apex domain with an ALIAS or ANAME record when possible because they are easier to set up and require less updating since they point your site to another domain name instead of an IP address. A records point your site to one or more IP address and require updating when the IP address changes.

Note: Some DNS providers support configuring apex domains with an ALIAS or ANAME record, but there is no industry standard for these. Only DNS Made Easy currently supports ANAME records and DNSimple is one of the few DNS providers that support ALIAS records.

Configuring an ALIAS or ANAME record with your DNS provider

  1. Contact your DNS provider for detailed instructions on how to set up ALIAS or ANAME records.

  2. Follow your DNS provider's instructions to create an ALIAS or ANAME record that points your apex domain to the GitHub Pages server at your default pages domain. Your DNS changes can take over a full day to update and the wait varies among DNS providers.

    Note: Your default GitHub Pages domain is determined by the type of pages site you have. For examples, see this domain chart.

  3. To confirm that your DNS record is set up correctly, use the dig command with your custom domain. Using a custom domain as an example:

    dig example.com +noall +answer
    example.com.     3600    IN A     199.27.XX.XXX
    

    When you use the dig command with your GitHub Pages default domain, your domain should resolve or point to the same IP address. For example:

    dig YOUR-USERNAME.github.io +noall +answer
    YOUR-USERNAME.github.io     3600    IN A     199.27.XX.XXX
    
  4. Add your custom domain to your GitHub Pages site. If you're updating an existing custom domain, first remove and then re-add your custom domain to your GitHub account to trigger the process of enabling HTTPS. For more information, see "Adding or removing a custom domain for your GitHub Pages site."

Configuring A records with your DNS provider

  1. Contact your DNS provider for detailed instructions on how to set up A records.

  2. Follow your DNS provider's instructions to create A records that point your custom domain to the following IP addresses:

    • 185.199.108.153
    • 185.199.109.153
    • 185.199.110.153
    • 185.199.111.153

    Tip: Your DNS changes can take over a full day to update and the wait varies among DNS providers.

  3. To confirm that your DNS record is set up correctly, use the dig command with your custom domain. Using a custom domain as an example:

    dig +noall +answer example.com
    ;example.com.
    example.com.   3600  IN  A 185.199.108.153
    example.com.   3600  IN  A 185.199.109.153
    example.com.   3600  IN  A 185.199.110.153
    example.com.   3600  IN  A 185.199.111.153
    

    Your apex domain should point to the IP addresses you configured.

  4. Add your custom domain to your GitHub Pages site. If you're updating the IP address of an existing A record, first remove and then re-add your custom domain to the repository you’re using to publish your Pages site to trigger the process of enabling HTTPS. For more information, see "Adding or removing a custom domain for your GitHub Pages site."

Further reading