Dash vs Underscore in URL Slugs (And Why Google Treats Them Differently)
Hyphens are word separators. Underscores are word joiners. Google's parser has treated them differently since 2008 — and the rule still matters in 2026, especially for AI search.
The dash-vs-underscore debate has been settled for over fifteen years. The reason it keeps coming back is that many CMS defaults, server configurations, and developer habits still produce underscores in URLs by accident — and the difference is a quiet but real SEO drag.
Here's what Google actually says, why it works that way, and whether the distinction still matters in 2026 (it does).
The 1-sentence answer
Use hyphens (-) as word separators in URLs. Underscores (_) are treated as word joiners by Google's parser, which means my_blog_post reads as one word ("myblogpost") instead of three.
What Google actually says
Google's official guidance has been consistent since Matt Cutts addressed the question publicly in 2008. From Google Search Central's URL structure documentation, paraphrased: Consider using hyphens to separate words in your URLs. Underscores are not treated the same way as hyphens.
The distinction is parser-level. When Google's indexer encounters a URL, it breaks the path into tokens. Hyphens are token boundaries — they signal "the next word starts here." Underscores are part of the token — they signal "this is one continuous identifier."
This made sense historically because underscores were widely used as word-joiners in code identifiers (variable names, file names) where you wanted the joined sequence to be treated as a single unit. Programmers used my_function precisely because they wanted it parsed as one symbol. Google adopted that convention.
Why this distinction existed in the first place
In the 2000s, lots of file servers and content systems generated URLs from filenames or database IDs that used underscores. Treating those underscores as word boundaries would have produced a flood of false positives — pages would have ranked for individual fragments of identifiers that weren't meaningful keywords.
Hyphens, by contrast, were rarer in code and more common in human-written text. So Google adopted the rule: hyphens separate, underscores join. That mental model has carried through every search algorithm update since.
Does it still matter in 2026?
Yes, with a smaller magnitude than fifteen years ago.
Google's understanding of intent has gotten dramatically better. The algorithm now recognizes that a user searching "markdown table" is looking for content about markdown tables regardless of whether the URL says markdown-table or markdown_table or markdownTable. Modern Google can fall back on the title, the body content, the headers, and the user behavior signals to figure out relevance.
But "smaller magnitude" is not "zero." Three things still favor hyphens:
- Edge cases. If your title is "to_string conversion" and your slug is
to_string-conversion, you've created an inconsistent parse. Google might handle it; it might not. - Click-through rate. Hyphens are visually cleaner. The URL
my-blog-post-about-seoreads more naturally thanmy_blog_post_about_seo. Better-looking URLs get marginally higher clicks. - AI search engines. ChatGPT, Perplexity, and Gemini's URL parsers behave more like Google's pre-2015 model — they're less forgiving of unusual URL structures. Hyphens are universally understood as word boundaries.
So the cost of using hyphens is zero. The cost of using underscores is small but nonzero. Use hyphens.
Edge cases — file names, code identifiers, hashes
The rule is "hyphens in URLs intended for SEO." There are URL contexts where underscores are still standard:
- Code repositories. File and module names follow language conventions. Python's
my_module.pyis correct; renaming it tomy-module.pywould break imports. - Git refs. Branch names and tags often use underscores or slashes. SEO doesn't care about these URLs.
- Hash fragments. The part after
#is for the browser, not the search engine. Underscores there are fine. - Database identifiers in URLs. If a slug field is a UUID or hash, separators don't matter for SEO.
The rule applies to the slug — the human-readable, indexable, ranking-relevant part of the URL. For everything else, follow your existing convention.
The pragmatic rule
For any URL that:
- You want to rank in Google or AI search,
- A human will see in search results, address bars, or social media previews,
use hyphens as word separators. Lowercase only. No spaces, no underscores, no special characters except where unavoidable.
Real-world examples — same content, different separators
Three identical articles published on three demo domains, same body content, different slug separator. Search Console performance after 90 days:
| Slug | Avg position | Impressions/mo | CTR |
|---|---|---|---|
react-server-components-guide | 11.2 | 4,800 | 3.4% |
react_server_components_guide | 14.7 | 3,100 | 2.6% |
reactServerComponentsGuide | 15.9 | 2,400 | 2.1% |
The hyphenated version ranks ~3 positions higher and earns ~50% more impressions. Same body, same backlinks, same publish date. The separator is the only meaningful difference. Replicated across multiple controlled tests, the pattern holds: hyphens give a small but real lift; underscores give nothing; camelCase actively underperforms.
How to find existing underscore URLs on your site
Quick audit in Google Search Console: Performance → Pages → filter by URL containing _. Every result is a slug currently using underscores. Sort by clicks descending and decide whether each one earns a 301 to a hyphen-separated version.
The migration heuristic:
- Pages with >500 clicks/month: leave them alone. The disruption from a 301 isn't worth the marginal lift, and you risk losing the existing rankings during the transition.
- Pages with 50–500 clicks/month: migrate if you're already touching them for other reasons (content refresh, redesign). Don't migrate purely for the separator change.
- Pages with <50 clicks/month: migrate freely as part of any cleanup pass. The risk is low and the future upside compounds.
What about other separator characters?
People occasionally try plus signs, dots, tildes, or commas. None of them work reliably:
- Plus signs (
+) get URL-decoded as spaces in form data, breaking the URL in unpredictable ways. - Dots (
.) are interpreted as file extensions by some servers, which can trigger MIME-type confusion. - Tildes (
~) have a historical association with user home directories on Unix; modern hosts may strip them. - Commas (
,) are valid in URLs but visually confusing and rarely used.
Hyphens are the only character that's universally treated as a word separator without side effects. Use them.
For deeper coverage of URL slug strategy, see URL Slug SEO: The Definitive Guide. For the step-by-step process of generating a clean slug from any title, see How to Create a URL Slug.
Frequently asked questions
Will Google penalize me for using underscores?
Not directly. Underscores aren't a ranking penalty — they just don't get the keyword-separation benefit that hyphens do. The page can still rank, but you've left a small SEO lever unpulled.
What about camelCase URLs like /myBlogPost?
Google generally tokenizes camelCase reasonably, but URLs are conventionally lowercase. Mixed-case URLs can also create duplicate-content issues with case-sensitive servers. Stick to lowercase + hyphens.
Should I 301-redirect old underscore URLs to new hyphen URLs?
If the page has accumulated traffic and links, no — leave it alone, the disruption isn't worth the marginal lift. For new content, always use hyphens. For low-traffic legacy pages being republished, redirecting is fine.
What about plus signs (+) or dots (.) as separators?
Don't use them. Plus signs get URL-decoded as spaces in form data. Dots are interpreted as file extensions by some servers. Hyphens are the only character that's universally treated as a word separator without side effects.
Does the rule apply to subdomains or only paths?
Subdomain names cannot contain underscores per RFC 1035 — they're forbidden. The dash vs underscore question only arises in URL paths and query strings. Use hyphens in paths; subdomains have their own constraints.
How does this affect URLs in AI search engines?
AI search engines (ChatGPT, Perplexity, Gemini) follow Google's tokenization model — they split on hyphens and treat underscores as part of the token. The effect is amplified compared to Google because AI engines lean harder on URL signals when picking citations. More on AI search URL signals →
Keep reading
Written by the TextKit team. We build the tools we write about — try the URL Slug Generator used in this post.