Slug Generator — Convert Text to a URL-Safe Slug
Slug generator turns any text — a blog post title, article headline, or product name — into a clean, URL-safe slug you can drop straight into a route or filename. Paste text with accents, punctuation, or mixed case and get a normalized result: diacritics are stripped (café becomes cafe), non-alphanumeric characters collapse into a single separator of your choice, and everything trims to avoid leading or trailing dashes. Toggle lowercase on or off, switch between hyphen and underscore separators, and cap the output at a maximum length without cutting words in half. Everything runs locally in your browser, so nothing you type is ever sent anywhere.
Features
Unicode-safe diacritic stripping
Accented characters are normalized and stripped, so "Café à la Mode" becomes "cafe-a-la-mode".
Hyphen or underscore separators
Switch between "-" and "_" to match your CMS, framework, or file-naming convention.
Lowercase toggle
Keep the default lowercase output, or turn it off to preserve original casing.
Smart max-length truncation
Cap the slug length and it trims at the last separator boundary instead of cutting a word in half.
Live preview and copy
The slug updates as you type, with a one-click copy button for the final result.
How to generate a URL slug online
Turn any title or text into a clean, URL-safe slug in seconds.
- Paste your textType or paste the title, heading, or text you want to slugify into the input box.
- Choose your optionsPick a separator (- or _), toggle lowercase, and set an optional max length.
- Copy the slugThe slug updates live as you type — click Copy to grab the result.
Examples
Convert a title with accents and punctuation
Café à la Mode: Best Recipes!
cafe-a-la-mode-best-recipes
Use underscore separator with a max length
The Ultimate Guide to Building REST APIs in 2026
the_ultimate_guide
With separator "_" and max length 20, the slug is trimmed at the last separator instead of cutting "to" in half.
Frequently Asked Questions
- Does it handle accented characters and emoji?
- Yes. Text is Unicode-normalized (NFD) and combining diacritical marks are stripped, so "é", "à", and similar accented letters become their plain ASCII equivalents. Emoji and other symbols are not alphanumeric, so they are removed and replaced by the separator like any other punctuation.
- Should I use a hyphen or an underscore?
- Hyphens are the standard choice for URL slugs — Google and most CMSs treat words separated by hyphens as distinct words, which helps SEO. Underscores are more common for filenames, environment variables, or identifiers where hyphens are not allowed.
- Does the max length setting cut words in half?
- No. If the slug is longer than the max length, it is truncated and then trimmed back to the last separator boundary within that limit, so you get whole words instead of a word chopped mid-way.
- Is this the same as encodeURIComponent?
- No. encodeURIComponent percent-encodes special characters but keeps spaces, casing, and punctuation structure. A slug instead normalizes everything down to lowercase alphanumeric words joined by a single separator — the format used in blog URLs, not a general-purpose URI encoding.
- Can I keep the original casing instead of lowercasing?
- Yes. Turn off the lowercase toggle and the original letter casing is preserved; only diacritics are stripped and non-alphanumeric runs are still collapsed into the chosen separator.
- Does any data leave my browser?
- No. The slug is generated entirely client-side with plain JavaScript — nothing you type is sent over the network.