URL slug

Lowercase, hyphenated, with diacritics stripped and special characters removed.

Where it's used

Blog post URLs, Product page URLs, SEO-friendly identifiers.

Worked examples

The engine handles every common input pattern — spaces, hyphens, underscores, camelCase humps, and ALLCAPS acronym runs — and produces the canonical URL slug output.

Input URL slug
10 Best Tips for Writing! 10-best-tips-for-writing
Café résumé naïve cafe-resume-naive
How to: A Beginner’s Guide how-to-a-beginner-s-guide
Hello, World! hello-world

Smart tokenization

Our engine splits identifiers correctly. HTMLParser doesn't become h_t_m_l_parser — the ALLCAPS run is recognized as a single token and produces html_parser. getXMLHttpRequest tokenizes to get, XML, Http, Request for clean output in any case format.

What a URL slug is

A URL slug is the human-readable portion of a URL that identifies a specific page. In https://transformcase.com/blog/best-text-tools-for-writers, the slug is best-text-tools-for-writers. Slugs are lowercase, hyphen-separated, ASCII-only, and stripped of punctuation and diacritics. They're designed to be readable by humans and indexable by search engines.

The word "slug" comes from journalism: a short label used to refer to a story in production before it has a final headline. The convention transferred to web publishing in the early 2000s, particularly through Movable Type and later WordPress, and is now universal.

Why slugs matter for SEO

Google explicitly uses URL words as a (minor) ranking signal. A page at /blog/best-text-tools-for-writers ranks better for the query "best text tools for writers" than the same page at /blog/post-12345. The improvement is small per page but compounds across a site with hundreds or thousands of URLs.

Slugs also affect click-through rate. URLs are shown directly in search results below the title. A descriptive slug previews what the page is about; an opaque slug provides no information. Users are measurably more likely to click URLs that look meaningful.

Beyond SEO, slugs are easier to remember, easier to share verbally, and easier to type. /about-us is friendlier than /p?id=42.

How slug generation works

Converting a title to a slug involves several transformations applied in order:

  1. Lowercase everything. URL paths are case-sensitive on Linux servers, so consistent lowercase prevents accidentally creating two URLs for the same page.
  2. Strip diacritics. "Café" becomes "cafe". "Niño" becomes "nino". This is called transliteration or folding. The conversion uses Unicode normalization (NFD) followed by removing combining characters.
  3. Remove punctuation. Apostrophes, quotes, parentheses, commas, exclamation marks — all removed. Some characters (ampersand, plus) might be replaced with words ("and", "plus") depending on the style.
  4. Replace spaces and remaining separators with hyphens. Spaces, underscores, slashes, multiple consecutive separators all collapse to a single hyphen.
  5. Trim leading and trailing hyphens. A title like "Hello!" might temporarily become "hello-" before the trailing hyphen is removed.
  6. Collapse consecutive hyphens. "Hello — World" might temporarily become "hello---world" before collapsing to "hello-world".
  7. Truncate to a reasonable length. 50-75 characters is conventional. Longer slugs are valid but uglier and harder to share.

Why hyphens, not underscores

This is one of the rare cases where convention is grounded in concrete evidence. Google's documentation states: "Use hyphens to separate words. We recommend that you use hyphens (-) instead of underscores (_) in your URLs."

The reason is that Google's crawler treats hyphens as word separators and underscores as part of a word. /best_text_tools is treated as one token; /best-text-tools is treated as three. This affects which queries the URL matches.

Other URL-shortening tools, social media platforms, and link auto-detectors all expect hyphens. Some platforms break URLs at underscores in unexpected ways. Hyphens are the safe, universal choice.

Handling international characters

The default slug convention transliterates non-ASCII characters to their closest ASCII equivalents. "Schöne Aussicht" becomes schone-aussicht. "東京" becomes either an empty string (because there's no ASCII equivalent) or a romanization (tokyo) depending on the transliterator.

Modern browsers and search engines support IDNs (Internationalized Domain Names) and Unicode URL paths, so theoretically a slug like /東京観光 could work. In practice, ASCII slugs remain more reliable across systems, copy-paste cleanly in chat applications, and don't trigger character encoding issues in older infrastructure. Most CMS systems default to ASCII slugs.

Common slug mistakes

  • Including stop words for SEO: "the best of the best" generating the-best-of-the-best is fine. Aggressively stripping articles ("a", "an", "the") and prepositions to game SEO is counterproductive — the resulting slug reads worse, and modern search engines aren't fooled.
  • Trailing dates or IDs: best-text-tools-for-writers-2024-1. Date suffixes work for content that's clearly time-bound but signal staleness for evergreen content. Better to update the article and keep the slug stable.
  • Stuffing keywords: best-text-tools-writers-text-tools-text-utilities-text-software. Repeating keywords in slugs hurts ranking and looks spammy to readers.
  • Changing slugs after publishing: every link to the old slug breaks unless you add a 301 redirect. Keep slugs stable.

When to deviate from automatic slugs

Automatic slug generation usually produces good results, but sometimes manual editing improves them. A title like "10 Reasons Why You Should..." generates a slug starting with 10-reasons-why-you-should — long, weak, and full of stop words. A manually-set slug like reasons-to-use-text-tools is shorter, clearer, and ranks better.

Editors who care about URL quality typically generate the automatic slug, then edit it. The goal is short, descriptive, and focused on the page's actual keywords. Three to six words is a sweet spot.

Convert to URL slug now.

Open the converter →

See all programming naming conventions.