What is a URL slug?
A URL slug is the human-readable part of a web address that identifies a specific page. In https://example.com/blog/my-first-post, the slug is my-first-post. Good slugs are concise, descriptive, and use only lowercase letters, numbers, and hyphens.
Slugs matter for two reasons: SEO and usability. Search engines use URL keywords as a ranking signal — a URL containing /generators/password tells Google what the page is about. For users, a clean slug is easier to read, share, and remember than a string of query parameters or random IDs.
Most web frameworks and CMS platforms generate slugs automatically from page titles, but the automatic output often needs manual refinement — removing stop words, trimming length, and ensuring the slug accurately represents the content.
Slug best practices
Keep it short. Aim for 3–5 words. Long slugs get truncated in search results and are harder to share. Remove stop words like "a", "the", "and", and "of" unless they're essential to the meaning.
Use hyphens, not underscores. Google treats hyphens as word separators but treats underscores as joiners. The URL /web-development matches searches for "web" and "development" separately, while /web_development may not.
Include target keywords. If your page targets "React performance tips", the slug /react-performance-tips reinforces that signal to search engines.
Never change slugs after publishing unless you set up a proper 301 redirect. Changing a slug breaks every inbound link and shared URL pointing to that page, and you lose any SEO authority the old URL had accumulated.
Use lowercase only. URLs are case-sensitive on most servers. Mixing cases leads to duplicate content issues and broken links.