How should identifiers, separators, and length be handled in URLs?

ProcrustesPR

If a website identifies pages by ID, a practical approach is to place the ID before the title portion of the URL, as in /123/slug-title. Use hyphens to separate words in the title and keep the description concise. Putting the ID first helps preserve identifying information if the end of the URL is truncated; it has no proven ranking advantage. Using only a unique text slug is also viable. The available information does not establish that adding an ID harms SEO.

ProcrustesPRProcrustesPRHow should I divide my DIY SEO budget?

Putting the ID first: can the page still be identified after truncation?

In a public technical discussion, one participant reported problems after an ID at the end of a URL was cut off. Another reply also recommended placing the ID before the title. Compare these two formats:

  • /123/slug-title: If only the end of the title is lost, the full ID may remain.
  • /slug-title-123: If the end, including the ID, is lost, the website may be unable to identify the original page.

Preserving the ID does not guarantee that the URL will still work. To find the correct page, the server must be able to look up content by ID and accept URLs with incomplete titles. The successful example in the discussion depended on how that particular website handled URLs; it does not mean every website will automatically repair truncated URLs.

Hyphens separate words; slashes indicate path structure

An October 2026 Search Engine Journal report quoted Google’s Gary Illyes as saying that words joined by underscores in a URL path are treated as one long word, though Google can sometimes still use the words within it. He recommended using hyphens as word separators. When creating the English title portion of a new URL, you can therefore use slug-title rather than slug_title. This does not mean Google necessarily fails to recognize words joined by underscores.

Readability is another consideration: participants noted that underscore characters may be hard to see when link text is underlined, causing confusion when URLs are copied by hand or dictated. A slash, however, is not simply another separator. It indicates path structure and should not be arbitrarily replaced with a hyphen just for appearance.

URL IDs and database primary keys are separate choices

For URLs that display only text, one suggestion in the discussion was to use unique text slugs and create a database index on the field that stores them. A numeric primary key can still be retained internally for application logic and table joins. Another suggestion was to add suffixes such as -2 to distinguish duplicate slugs; the full ID does not always need to appear in the URL.

Opinions differed on lookup performance: some considered an index sufficient for single-record lookups, while others worried that string lookups would be slower than numeric-key lookups. These discussions provided no comparative tests, so they cannot establish that the two perform equally or that using text-based URLs is necessarily slow.

Keep descriptions concise rather than lengthening URLs for keywords

The same 2026 report quoted Illyes as saying that keywords in URLs have very little influence on rankings. They may be useful mainly when Google has almost no other information. Once Google has seen the page content, their importance drops substantially. Rather than piling up near-synonyms, use a short description that explains the page’s content.

The available information provides no universally optimal word count and does not establish that search engines cut off IDs when URLs reach a particular length. Putting the ID first is a design consideration for URLs that might be truncated, not a confirmed search-engine rule on URL length.

ProcrustesPRProcrustesPRWhy can I not find my published article on Google?

URL identifiers and length: perspectives from across the web

Once a URL contains an ID, can its title portion be freely changed or omitted?

That depends on how the website handles URLs; the presence of an ID alone does not establish that this is possible. A public discussion gave an example of a website where the same question could be accessed through either a URL containing its title or a shorter URL containing only its ID. To support this on your own website, the server must be able to identify content by ID and handle missing or mismatched titles.

Can a more compact encoding be used to shorten a numeric ID?

A technical discussion proposed converting numeric IDs to base 36, which shortened the identifier in the example. However, the person proposing it explicitly said this was a theoretical exploration and that they were not seriously considering implementing it. The material also did not compare implementation costs, appearance, or search performance. It can therefore be considered a design option, but the discussion does not establish that it is necessarily worth adopting or offers an SEO advantage.

Should all existing URLs with underscores be changed to hyphens for search rankings?

The separator alone is not sufficient reason to conclude that all URLs must be changed. An older article advised against rewriting every existing URL containing underscores, reasoning that the changes would require search engines to reindex them and might do more harm than good. This was advice from that time, not a current platform rule. Any proposed adjustment should account for the impact of changing URLs, rather than simply comparing the two characters.

What other display trade-offs are there between hyphens and underscores?

One participant found hyphens easier to read; another noted that hyphens readily allow line breaks, whereas underscores do not. On the other hand, when an entire URL appears as an underlined link, underscore characters may be difficult to see in some browsers, causing confusion when the URL is copied by hand or dictated. These observations reflect particular usage contexts and personal experiences, not guaranteed behavior across all interfaces.

ProcrustesPREight SEO essentials for beginners: Website speed

References

  1. Matt Cutts 再次解釋 URL 地址中破折號和下劃線的區別www.domainclub.org — Discusses: Should all existing URLs with underscores be changed to hyphens for search rankings?
  2. Google Launches A Video Series For Odd Technical SEO Questionswww.searchenginejournal.com · 2026-10-14T18:51:41+00:00 — Source used in the article above.
  3. SEO - reducing URL lengthwebmasters.stackexchange.com — Discusses: Can a more compact encoding be used to shorten a numeric ID?
  4. URLs: Should I use hyphens, underscores or plus symbols?webmasters.stackexchange.com — Discusses: What other display trade-offs are there between hyphens and underscores?
  5. What is the best placement for the ID in a URL for SEO?webmasters.stackexchange.com — Source used in the article above.
  6. URLs: Should I use hyphens, underscores or plus symbols?webmasters.stackexchange.com — Discusses: What other display trade-offs are there between hyphens and underscores?
  7. URLs: Should I use hyphens, underscores or plus symbols?webmasters.stackexchange.com — Discusses: What other display trade-offs are there between hyphens and underscores?
  8. SEO: adding an unecessary description key in dynamic url is it good or not?webmasters.stackexchange.com — Source used in the article above.
  9. SEO: adding an unecessary description key in dynamic url is it good or not?webmasters.stackexchange.com — Source used in the article above.
  10. SEO: adding an unecessary description key in dynamic url is it good or not?webmasters.stackexchange.com — Source used in the article above.
  11. Can people's names be added to a URL slug?webmasters.stackexchange.com — Source used in the article above.
  12. SEO: adding an unecessary description key in dynamic url is it good or not?webmasters.stackexchange.com — Source used in the article above.
  13. Can people's names be added to a URL slug?webmasters.stackexchange.com — Discusses: Once a URL contains an ID, can its title portion be freely changed or omitted?
  14. What is the best placement for the ID in a URL for SEO?webmasters.stackexchange.com — Discusses: Once a URL contains an ID, can its title portion be freely changed or omitted?
  15. Slashes in URLs and SEOwebmasters.stackexchange.com — Source used in the article above.
  16. Which URL format is better? example.com/[id]/title OR example.com/title/[id].htmlwebmasters.stackexchange.com — Source used in the article above.

Related articles

How should I divide my DIY SEO budget?Why can I not find my published article on Google?Eight SEO essentials for beginners: Website speedEight SEO essentials for beginners: Getting your pages indexedEight SEO essentials for beginners: Page titles and descriptionsThe Five Most Common Mistakes SEO Beginners MakeHow to Set Up Heading Tags for SEO: Define Topics and Hierarchy Before Adding KeywordsWhat are the benefits and development challenges of SPAs?
ProcrustesPR
ProcrustesPR