How to set up a custom domain on GitHub Pages
Quick answer
To use a custom domain on GitHub Pages, open the repository's Settings > Pages, type the domain under Custom domain, and click Save. Then, at your DNS provider, add a CNAME record that points www to <user>.github.io, or 4 A records (185.199.108.153 to 185.199.111.153) for the apex domain. DNS changes take up to 24 hours, and Enforce HTTPS turns on after that. For a page that collects signups or sells something, Convika's Free plan connects your own domain too, from an uploaded HTML file, with a form that keeps every entry and 90 days of visitor stats. GitHub's docs were read on November 17, 2026.
Free plan: no credit card, 1 custom domain, 1 published page, 50 form entries a month shown.
On this page
To put a custom domain on a GitHub Pages site, open the repository's Settings > Pages, type the domain under Custom domain, and click Save. Then add the DNS records at your DNS provider: a CNAME record that points www to <user>.github.io, or 4 A records for the apex domain, example.com. DNS changes "can take up to 24 hours to propagate," and after that you select Enforce HTTPS.
The steps and every DNS value below are from GitHub's own docs, read on November 17, 2026.
The DNS records GitHub Pages needs
| Your domain | Record type | Name | Value |
|---|---|---|---|
www.example.com | CNAME | www | <user>.github.io or <organization>.github.io |
Another subdomain, such as blog.example.com | CNAME | blog | <user>.github.io or <organization>.github.io |
The apex, example.com | A (add all 4) | @ | 185.199.108.153, 185.199.109.153, 185.199.110.153, 185.199.111.153 |
| The apex, with IPv6 | AAAA (add all 4, beside the A records) | @ | 2606:50c0:8000::153, 2606:50c0:8001::153, 2606:50c0:8002::153, 2606:50c0:8003::153 |
| The apex, where your DNS provider has ALIAS or ANAME | ALIAS or ANAME, in place of the A records | @ | <user>.github.io or <organization>.github.io |
Three rules from GitHub's docs save the most time:
- The CNAME value has no repository name. GitHub says the record "should always point to
<user>.github.ioor<organization>.github.io, excluding the repository name," for a project site too. - Add the domain on GitHub before you touch DNS. GitHub's warning: configuring DNS first "could result in someone else being able to host a site on one of your subdomains."
- No wildcard records. GitHub "strongly" recommends against
*.example.com, which puts the domain "at an immediate risk of domain takeovers."
Set up the custom domain in 5 steps
Verify the domain in your account
GitHub recommends "verifying your custom domain prior to adding it to your repository." Click your profile picture, then Settings, then Pages in the sidebar, and Add a domain. Enter the domain, select Add domain, and create the TXT record GitHub shows, named _github-pages-challenge-USERNAME.example.com. Once the record is live, click Verify. Keep the TXT record: it keeps the domain verified, and no other GitHub account can then publish a site on it or on its immediate subdomains.
Add the domain to the repository
In the site's repository, click Settings, then Pages under "Code, planning, and automation." Under Custom domain, type www.example.com or example.com and click Save. When the site publishes from a branch, this "will create a commit that adds a CNAME file directly to the root of your source branch." When it publishes from a GitHub Actions workflow, no CNAME file is created or needed.
Add the DNS records
At your DNS provider, add the records from the table above: one CNAME for a subdomain, or the 4 A records for the apex. If your provider set a default record on the same name, remove it first. GitHub recommends setting up www beside the apex: with both configured, GitHub Pages redirects one to the other.
Check the records
DNS changes take up to 24 hours. To check from a terminal:
dig www.example.com +nostats +nocomments +nocmd
dig example.com +noall +answer -t A
The first shows a CNAME to <user>.github.io; the second shows the 4 A records. Windows has no dig: use Resolve-DnsName in PowerShell.
Turn on Enforce HTTPS
Back under Settings > Pages, select Enforce HTTPS. GitHub requests the certificate from Let's Encrypt on its own once the DNS check passes, and shows a check mark beside the domain when it's done. The option "can take up to 24 hours" to become available.
www, the apex domain, or both
GitHub recommends "always using a www subdomain, even if you also use an apex domain," because www subdomains "are not affected by changes to the IP addresses of GitHub's servers." Set the one you want visitors to see as the custom domain, and add the DNS records for both:
- Custom domain
www.example.com, plus the apex A records:example.comredirects towww.example.com. - Custom domain
example.com, plus thewwwCNAME:www.example.comredirects toexample.com.
A custom domain on a user or organization site also applies to that account's project sites: with www.octocat.com on the user site, the repository octo-project opens at www.octocat.com/octo-project.
Fix a GitHub Pages custom domain that doesn't work
- The custom domain disappears after a deploy. A build that force-pushes the publishing branch overwrites the
CNAMEfile. Keep the file in your source so every build includes it. Its name is all uppercase, and it holds one domain and nothing else. - "Domain is already taken." Another repository has the domain. Verify the domain in your account, which releases it from sites owned by other users, or click Remove under Custom domain in the other repository.
- Enforce HTTPS is greyed out, or "Certificate not yet created." HTTPS can take up to an hour after the domain is set. If it stalls, click Remove beside the domain, type it again, and click Save, which restarts the certificate request. Extra A, AAAA, ALIAS, or ANAME records on
@, or a second CNAME on the subdomain, can block the certificate. If the domain has CAA records, one of them has to allowletsencrypt.org. - The site opens on
wwwbut not on the apex, or the other way round. The missing name has no record. Add the 4 A records for the apex or the CNAME forwww. Don't point a subdomain's CNAME at your apex domain: GitHub says that breaks HTTPS. - Images or styles vanish after HTTPS. The page loads them over
http://. Change those URLs tohttps://. - The old address still opens. Clear the browser's cache.
One site takes one apex domain and one www subdomain. GitHub's docs list more than one apex domain, more than one www subdomain, and an apex with a different custom subdomain on the same site as unsupported.
What GitHub Pages asks of the site behind the domain
- A public repository on GitHub Free. Pages "is available in public repositories with GitHub Free," and in private repositories from GitHub Pro. The published site is public either way.
- No online business. GitHub's limits page says Pages is "not intended for or allowed to be used as a free web-hosting service to run your online business, e-commerce site, or any other website that is primarily directed at either facilitating commercial transactions or providing commercial software as a service (SaaS)." GitHub Pages commercial use covers where the line falls.
- Files only. Pages is "a static site hosting service," so a contact form or a signup form needs a service of its own.
- Size and traffic. A site can be up to 1 GB, with a soft bandwidth limit of 100 GB a month. GitHub Pages limits lists the rest.
A custom domain with a form and visitor stats: Convika
A page that takes signups, bookings, or orders needs more than the files online. On Convika, the Free plan connects your own domain to a page you upload, with no repository and no build, and business use is allowed on every plan.
| Convika Free | GitHub Pages | |
|---|---|---|
| What you publish | An HTML file, a folder, or a ZIP, uploaded in the browser, or code pasted from an AI chat | Files in a GitHub repository; public on GitHub Free |
| Custom domain | 1, such as www.yourbrand.com | A subdomain or the apex domain |
| DNS records | A CNAME and a TXT for www; an A record sends the bare yourbrand.com to it | A CNAME for www; 4 A records for the apex; a TXT to verify |
| HTTPS | Issued for you once the records are found | Issued for you; select Enforce HTTPS |
| A site that sells | Allowed on every plan | Not allowed for an online business or e-commerce site |
| A form that keeps entries | Yes: saved, emailed to you, exported as CSV or JSON; 50 a month shown | Files only |
| Visitor stats | Visits, referrers, UTM campaigns, devices, countries, and button clicks for 90 days | Not in its docs |
| Price | $0, with the Convika bar; Pro is $12 a month | Free |
To move a page there, download its index.html from the repository, or the folder with its CSS and images, and drop it into Convika's upload box. Click Keep this page — free, no card, then Publish page, Public, Next, and Publish free. On the page's screen, click Connect my domain, add www.yourbrand.com, and replace the CNAME that points to <user>.github.io with the one Convika shows. Putting a page on your own domain walks through each screen, and HTML contact form code has a form to copy.
For more hosts, see GitHub Pages alternatives.
Skipbox
Cheap & fast GitHub Actions runners, unlimited for $39 a month
Your own machine keeps Docker layers and package caches between jobs. Switch by changing one runs-on line.
Start a free Skipbox trialFrequently asked questions
Can I use a custom domain with GitHub Pages for free?
Yes. GitHub Pages connects a custom domain at no charge, from a public repository on GitHub Free. You pay only your registrar for the domain itself. Convika's Free plan connects 1 custom domain as well, with a form and visitor stats, from an uploaded HTML file.
What DNS records does GitHub Pages need?
For www or another subdomain, a CNAME record pointing to <user>.github.io. For the apex domain, 4 A records: 185.199.108.153, 185.199.109.153, 185.199.110.153, and 185.199.111.153, or an ALIAS or ANAME record pointing to <user>.github.io. For IPv6, add the 4 AAAA records beside the A records.
How long does a GitHub Pages custom domain take to work?
Up to 24 hours. GitHub's docs say "DNS changes can take up to 24 hours to propagate," HTTPS can take up to an hour after the domain is configured, and the Enforce HTTPS option "can take up to 24 hours before this option is available."
Why can't I enable Enforce HTTPS on GitHub Pages?
The certificate hasn't been issued yet. Wait up to an hour after setting the domain. If it's still unavailable, remove the custom domain and add it again to restart the request, delete extra A, AAAA, or CNAME records on the same name, and check that any CAA record allows letsencrypt.org. The full domain name has to be shorter than 64 characters.
Should the CNAME record point to my repository's URL?
No. Point it to <user>.github.io or <organization>.github.io, without the repository name, for a project site too. GitHub also says not to point it at the *.pages.github.io address shown in the repository's Pages settings.
Can I use a custom domain on GitHub Pages with a private repository?
From GitHub Pro. On GitHub Free, Pages works only in public repositories. The site itself is public on the internet in both cases. GitHub Pages and private repositories has the details.
Can I use a GitHub Pages custom domain for my business site?
GitHub says Pages is not allowed "to run your online business, e-commerce site," or SaaS. Convika's Free plan allows commercial use and connects your own domain to the same HTML files, with a form that saves each inquiry.
Can I connect more than one domain to a GitHub Pages site?
One apex domain and its www subdomain, which redirect to each other. GitHub's docs list more than one apex domain, or an apex with a different custom subdomain, as unsupported, and the CNAME file holds a single domain.
Sources
All from GitHub Docs, read on November 17, 2026. The pages show no dates.
Next step
How to password protect an HTML page or website
A JavaScript password script leaves the password in the page source. To password protect an HTML page or link, encrypt the file or let a server check it.
Related articles
- Can I put a page ChatGPT or Claude made on my own domain without paying for hosting?Yes, you pay only for the domain. Convika's Free plan connects www.yourbrand.com with 2 DNS records and issues HTTPS. The records Cloudflare Pages, GitHub Pages, Netlify, and Vercel ask for, too.
- Is GitHub Pages free? GitHub Pages limits on size, bandwidth, and buildsYes, GitHub Pages is free for public repositories on GitHub Free. Its size limit is 1 GB a site, with soft limits of 100 GB of bandwidth a month and 10 builds an hour.
- Is GitHub free for commercial use, and can GitHub Pages host a business site?Yes for GitHub, whose terms let each “person or legal entity” keep a free account. Not for a business on GitHub Pages, per GitHub's terms of August 27, 2026.
- GitHub Pages alternatives for a one-page site (no git needed)Netlify, Cloudflare Pages, Vercel, Tiiny Host, Carrd, and Convika compared with GitHub Pages on git, forms, passwords, custom domains, and commercial use.
- Can you use GitHub Pages with a private repo for free?On GitHub Free, a Pages repo must be public. Pro, Team, and Enterprise Cloud publish from private repos, and the site stays public outside Enterprise Cloud.
- Can I use my own domain on Netlify's free plan, and what does it cost?Yes: Netlify Free includes custom domains with free HTTPS, and connecting one uses no credits. What a domain bought through Netlify costs, and the catches.