Slugify
Turn a title into a clean, URL-friendly slug.
Frequently asked questions
What is a slug?
A slug is the URL-friendly version of a title — lowercase, with spaces and punctuation replaced by hyphens, so it is readable and safe in a web address.
Why use slugs?
Clean, keyword-rich slugs are easier for people to read and share and can help with search engine optimisation compared with query strings or IDs.
How does it handle accents and symbols?
Accented letters are simplified to their closest ASCII equivalent and other symbols are removed, leaving letters, numbers and hyphens.
Should a slug use hyphens or underscores?
Search engines treat hyphens as word separators but underscores as joiners, so hyphens are the recommended choice for readable, SEO-friendly slugs.
Should slugs be lowercase?
Yes. Using lowercase avoids duplicate URLs caused by case differences, since some servers treat differing cases as separate pages, and it keeps links consistent and easy to type.
How long should a URL slug be?
Short and descriptive is best, ideally a few meaningful words. Trimming stop words and filler keeps the slug concise while retaining the keywords that describe the page.
What happens to non-English characters in a slug?
Accented Latin letters are simplified to their closest ASCII equivalent, and characters from scripts without a clear ASCII mapping are usually removed, leaving a clean, portable slug.