Slug Generator
Convert a title into a URL slug — accents stripped, punctuation removed, words joined by a hyphen or underscore, with optional filler-word removal and a length cap.
How it works
The title is first decomposed so accented letters split into a base letter and its mark, and the marks are then removed. That is why “Café Münster” becomes “cafe-munster” rather than losing the letters entirely, which is what a naive strip of non-ASCII characters does.
Everything that is not a letter or digit becomes a word boundary, apostrophes are deleted rather than turned into separators so “it's” stays “its”, and the surviving words are joined with your chosen separator. The length cap trims at a word boundary, never mid-word.
The formula
Slug
decompose accents → strip marks → split on non-alphanumerics → join with separator
Length cap
trim to the limit, then back to the last separator
Worked examples
| Scenario | Working | Result |
|---|---|---|
| “Café Münster's Menu!” | Accents stripped, apostrophe dropped | cafe-munsters-menu |
| “How to Bake Bread” | Filler words removed | bake-bread |
| “10 Easy Steps — Part 2” | Default settings | 10-easy-steps-part-2 |
When you'd use it
- Creating a permalink for a blog post or product page
- Naming files and folders consistently
- Generating stable ids for anchors and headings
- Keeping URLs readable when a title contains accents or symbols
Common questions
Should I use hyphens or underscores?
Hyphens, for URLs. Search engines treat a hyphen as a word separator and an underscore as a joiner, so “my-blog-post” reads as three words while “my_blog_post” can read as one. Underscores are fine for filenames and code.
Is it worth removing filler words?
Sometimes. Dropping “a”, “the” and “of” shortens a long slug without losing meaning, which helps readability. Do not strip so much that the slug stops describing the page — that costs more than the length saves.
How long should a slug be?
Short enough to read at a glance — commonly under about 60 characters. The length cap trims at a word boundary so you never end up with a half word at the end.

