Is www or non-www better for SEO?
Neither version is better for SEO. Google ranks www.example.com and example.com equally, as long as you pick one, redirect the other to it with a permanent 301 redirect, and use it consistently in canonical tags, sitemaps and internal links. The real differences are technical: cookies, DNS and CDN flexibility.
This question has not changed much since the early web, but the stakes have. Search engines and AI answer engines both reward sites that send clean, consistent signals. A site that serves the same page on four addresses (http, https, www and non-www) splits those signals and wastes crawl effort.
This guide explains what the "www" prefix actually is, the genuine pros and cons of each option, and the exact steps to set up your preferred version. If you are migrating between the two, the section on redirects matters most.
What is the difference between a www and a non-www URL?
The difference is that "www" is technically a subdomain of your root domain, while a non-www URL uses the root domain itself, also called the apex or naked domain. So www.example.com and example.com are two distinct hostnames that can serve different content.
In practice, most sites serve identical content on both. That is exactly the problem. To a crawler, two hostnames serving the same page look like duplicates until you tell it which one is preferred.
| Aspect | www.example.com | example.com |
|---|---|---|
| DNS type | Subdomain | Apex (root) domain |
| Can use a CNAME record | Yes | Not by standard DNS rules |
| Cookie scope | Can be limited to www host | Often shared with all subdomains |
| Length and look | Longer, traditional | Shorter, modern |
Brands like Google and Amazon use www. Many newer startups use the naked domain. Both approaches rank well. Your choice should come from infrastructure needs and brand preference, not ranking myths.
Does Google prefer www or non-www?
Google has no preference between www and non-www. What Google cares about is that you choose one canonical version and signal it clearly, so it can consolidate ranking signals onto a single URL instead of splitting them across duplicates.
Google's documentation on consolidating duplicate URLs lists the signals it uses to pick a canonical. Redirects are a strong signal. The rel="canonical" tag is a strong signal. Sitemap inclusion is a weaker signal.
If your signals conflict, Google may choose a canonical you did not intend. For example, your sitemap lists www URLs, but your internal links point to non-www, and neither redirects. Google then guesses.
The same logic applies to AI search. Google says there are no additional requirements for AI Overviews beyond normal SEO best practice. A clean canonical setup is part of that baseline. It keeps links, mentions and citations pointing at one address.
What are the pros and cons of using www?
The main advantage of www is technical flexibility: it works cleanly with CNAME records and lets you scope cookies tightly. The main downside is a slightly longer address that some brands feel looks dated.
Pros of www URLs:
- CNAME support. You can point www at a CDN or hosting provider with a CNAME record. Standard DNS does not allow a CNAME at the apex.
- Cookie isolation. Cookies set on www.example.com do not automatically go to static.example.com. This keeps static asset requests lighter.
- Clear signal. Some users still recognise "www" as a website address in print and offline ads.
Cons of www URLs:
- Four extra characters in every URL.
- Users often type the naked domain anyway, so the redirect must always work.
For large sites with many subdomains, a CDN in front, and separate cookie needs, www is often the more practical choice. The MDN guide to HTTP cookies explains how the Domain attribute controls which hosts receive a cookie.
What are the pros and cons of non-www?
The main advantage of a non-www domain is a shorter, cleaner address that matches how people type and say your brand. The main downside is DNS: you cannot use a standard CNAME at the apex, so you need A records or a provider feature.
Pros of non-www URLs:
- Shorter and memorable. Better for social bios, podcasts and voice.
- Modern look. Common for SaaS products and newer brands.
- Matches typing habits. Many users never type the www.
Cons of non-www URLs:
- DNS limits. Most providers work around the apex CNAME rule with features like Cloudflare's CNAME flattening or ALIAS and ANAME records. Without one, you must use fixed A records.
- Cookie spill. Cookies set on the apex domain with a Domain attribute are sent to every subdomain.
For small business sites on a modern DNS host, these limits rarely matter. Pick what fits your brand and move on.
How do you set up your preferred domain correctly?
To set up your preferred domain, choose one hostname, force HTTPS, 301-redirect every other variation to it, and make every canonical tag, sitemap URL and internal link use that exact version. Then verify the whole domain in Google Search Console.
Follow these steps in order:
- Pick one version. For example, https://example.com.
- Install SSL for both hostnames. The redirect itself needs a valid certificate on the non-preferred host.
- Add 301 redirects. Send http://example.com, http://www.example.com and https://www.example.com to the preferred URL in one hop.
- Update canonical tags. Each page should self-reference the preferred version.
- Update the sitemap. List only preferred URLs.
- Fix internal links. Replace hard-coded links to the old hostname.
- Set the WordPress Site Address, or your CMS equivalent, to the preferred version.
- Verify a Domain property in Search Console so you see all variants.
Our free meta analyzer tool shows the canonical tag on any page, which is a quick way to spot mismatches.
How do you switch from www to non-www without losing rankings?
You switch safely by treating it as a site move: map every old URL to its exact new equivalent with page-level 301 redirects, update all internal signals, and keep the redirects in place permanently. Rankings usually settle once Google recrawls the redirected URLs.
Google's guide to moving a site with URL changes covers the full process. The key points for a hostname switch:
- Redirect page to page, never everything to the homepage.
- Keep paths identical. Only the hostname should change.
- Avoid redirect chains, such as http to https to www to non-www. Collapse them into one hop.
- Keep redirects live for at least a year. Google suggests keeping them longer where possible.
- Update external links you control, such as social profiles and directory listings.
Google explains that permanent server-side redirects are the most reliable way to signal a move. Expect some fluctuation for a few weeks. If rankings drop for months, check for broken redirects or pages returning errors. A technical SEO audit will catch these quickly.
What common www mistakes hurt SEO?
The most common mistakes are serving both versions without a redirect, using temporary 302 redirects, pointing canonicals at the wrong hostname, and creating redirect chains. Each one splits or delays ranking signals.
Watch for these problems:
- No redirect at all. Both hostnames return 200. Google must guess the canonical.
- 302 instead of 301. Temporary redirects send a weaker signal about the permanent address.
- Mixed signals. The sitemap says www, the canonical says non-www.
- Missing SSL on the secondary host. Visitors hit a certificate warning before the redirect fires.
- Redirect chains. Every extra hop adds latency and risk.
- Hard-coded asset URLs. Images and scripts loading from the old host cause mixed signals and extra redirects.
Test every variation with a header checker. Each should return a single 301 to the exact preferred URL. That small check solves most www problems before they start.
Frequently asked questions
Does www affect Google rankings?
No. Google does not rank www or non-www domains differently. What affects rankings is consistency. If both versions load without a redirect, ranking signals such as links can be split between two URLs. Choose one version, redirect the other with a 301, and use it everywhere.
Should a new website use www or non-www?
Either is fine for a new website. Choose non-www if you want a short, modern brand address and your DNS host supports apex flattening. Choose www if you expect many subdomains, heavy CDN use or strict cookie separation. Decide once and never switch without a reason.
Is it bad to have both www and non-www working?
It is bad if both load the same page with a 200 status. Search engines see duplicate content and must pick a canonical themselves. Having both addresses resolve is fine, as long as one permanently redirects to the other in a single hop.
How long does it take Google to update after a www redirect?
It depends on how often Google crawls your pages. Important, frequently crawled pages can update within days. Deeper pages may take weeks or longer. Submitting an updated sitemap and inspecting key URLs in Search Console helps Google discover the redirects faster.
Do I need separate Search Console properties for www and non-www?
Not if you use a Domain property. A Domain property verified by DNS covers www, non-www, http and https together. With URL-prefix properties, each hostname and protocol needs its own property, which makes it easy to miss data from the non-preferred version.
Does www vs non-www matter for AI search engines?
Not directly. AI answer engines do not favour either format. Consistency still helps, because links, mentions and citations that all point to one canonical address build clearer authority. Duplicate hostnames can dilute those signals and confuse crawlers about which URL to cite.