A URL slug is the part of a web address that comes after the domain name and identifies a specific page in a human-readable format. For example, in the URL "example.com/blog/what-is-url-shortening," the slug is "what-is-url-shortening." Slugs are typically generated from page titles by converting to lowercase, replacing spaces with hyphens, and removing special characters.
URL slugs play a critical role in SEO because search engines use them as signals to understand page content. A descriptive slug that includes relevant keywords can improve a page's visibility in search results. Google's documentation explicitly recommends using simple, descriptive URLs that convey the page's topic.
In URL shortening services, the slug concept applies to custom aliases. When a user creates a short URL with a custom code, that code functions as the slug for the shortened link. The same best practices apply: keep it concise, use meaningful words, and avoid special characters.
Slug generation algorithms must handle edge cases such as duplicate titles, non-ASCII characters, and reserved words. Unicode slugs require transliteration or encoding decisions that vary by platform and target audience.