🔗 Slug / URL Generator
Convert any title or phrase into a clean URL slug. Handles special characters, accents, and spaces. Free online slug generator for SEO-friendly URLs — instant results.
How to Use
Enter your text
Type or paste any title or text. The slug is generated and updated in real-time as you type.
Customize the output
Choose your separator (hyphen or underscore) and toggle lowercase.
Copy the slug
Click Copy to copy the generated slug to your clipboard.
Frequently Asked Questions
Complete Guide: Slug Generator
A slug is the URL-friendly portion of a web address that identifies a specific page or resource. For example, in the URL https://example.com/blog/my-first-post, the slug is my-first-post. Slugs are lowercase, contain only letters, digits, and hyphens, and carry no spaces or special characters. Getting slugs right matters for both usability and search engine optimization.
What Makes a Valid Slug?
A well-formed slug follows these rules consistently:
- All characters are lowercase
- Words are separated by hyphens, not underscores or spaces
- No consecutive hyphens (
--becomes-) - No leading or trailing hyphens
- Accented characters are transliterated to ASCII equivalents (é→e, ü→u, ç→c)
- Special symbols, punctuation, and emoji are removed
Transliteration and Turkish Characters
Transliteration converts non-ASCII characters to their closest ASCII equivalents. This is critical for international content. Standard mappings include é→e, à→a, ö→o, and ü→u. Turkish presents its own set of characters that require specific attention:
- ş → s
- ğ → g
- İ → i (dotted capital I)
- ı → i (dotless lowercase i)
- ç → c
- ö → o
- ü → u
Failing to handle Turkish characters properly results in slugs that either contain raw Unicode percent-encoding (ugly and long) or completely lose meaning when the characters are simply stripped.
Step-by-Step Slug Generation Algorithm
- Convert the input string to lowercase
- Apply a transliteration map to replace accented and special-language characters
- Replace any remaining non-alphanumeric characters (except hyphens) with a hyphen
- Collapse consecutive hyphens into a single hyphen using a regex like
/\-+/ - Trim leading and trailing hyphens
A minimal JavaScript implementation looks like this:
function slugify(text) {
return text
.toString()
.toLowerCase()
.replace(/ş/g, 's').replace(/ğ/g, 'g')
.replace(/ı/g, 'i').replace(/İ/g, 'i')
.replace(/ç/g, 'c').replace(/ö/g, 'o').replace(/ü/g, 'u')
.replace(/[^a-z0-9\s-]/g, '')
.trim()
.replace(/\s+/g, '-')
.replace(/-+/g, '-');
}
Slugs in Popular Frameworks
WordPress generates slugs automatically from post titles using its sanitize_title() function, which you can override with the sanitize_title filter. Django provides a SlugField model field and the slugify() utility in django.utils.text. Ruby on Rails uses the parameterize method on strings, which handles transliteration via the i18n gem's transliterate helper.
SEO and Slug Best Practices
Slugs directly influence search rankings because they appear in the URL, which search engines use as a relevance signal. Keep these principles in mind:
- Place your primary keyword as early in the slug as possible
- Keep slugs short — 3 to 5 words is the sweet spot
- Avoid stop words (the, a, of, in) unless they are essential to meaning
- Never change a published slug without setting up a 301 redirect
- Use hyphens, not underscores — Google treats hyphens as word separators
For text case transformations before slugifying, see the Case Converter tool. If you need to encode a full URL rather than just a path segment, use the URL Encoder.
Common Mistakes to Avoid
A frequent mistake is leaving numbers with leading zeros in slugs, which can look like octal notation to some systems. Another pitfall is not normalizing Unicode before processing — the character "é" can be encoded as a single codepoint (U+00E9) or as "e" plus a combining accent (U+0065 + U+0301), and naïve string replacement only catches one form. Always normalize to NFC or NFD before applying your transliteration map.