URL Slug Generator
Turn a title into a clean URL slug. Handles Turkish correctly, where the usual accent-stripping recipe silently turns "Işık" into "is-k".
Type a title on the left and the slug appears here immediately.
The text is processed in your browser and never sent to a server.
Key Takeaways
- The popular accent-stripping recipe is wrong for Turkish: it turns "Işık" into "is-k", because the dotless ı has no decomposition and the dotted İ decomposes to an ASCII I plus a combining mark.
- The correct order is explicit map first, decomposition second. Done the other way round, ş happens to work, which makes the bug look half fixed and is why it ships everywhere.
- A slug is permanent. Changing a published one creates redirect debt, so getting it right the first time is worth more than it looks.
- Letters such as ß, ø and ł are not accented forms but distinct letters; decomposition leaves them alone and an ASCII filter then deletes them silently.
The recipe everyone uses, and why it breaks
Search for how to build a slug and you will find the same four steps every time: decompose, strip combining marks, lowercase, replace anything that is not alphanumeric with a hyphen.
text .normalize('NFD') .replace(/\p{M}/gu, '') .toLowerCase() .replace(/[^a-z0-9]+/g, '-')It works for English and French. It does not work for Turkish, and the way it fails is unusually easy to miss.
| Input | Common recipe | Correct |
|---|---|---|
| Işık | is-k | isik |
| yığın | y-g-n | yigin |
| Diyarbakır | diyarbak-r | diyarbakir |
| Ağrı Dağı | agr-dag | agri-dagi |
The cause: two letters that decompose unusually
Unicode decomposition splits an accented letter into a base letter plus a combining mark. Two Turkish letters do not fit that model.
'İ'.normalize('NFD') // 'I' + U+0307 (an ASCII capital I, plus a dot)'ı'.normalize('NFD') // 'ı' (no decomposition at all)'ş'.normalize('NFD') // 's' + U+0327 (this one works correctly)The dotted İ decomposes to an ASCII I, so the letter changes class entirely. The dotless ı has no decomposition, so it survives the mark-stripping step and is then deleted for not being ASCII, leaving a separator in its place.
Here is what makes this dangerous rather than merely wrong: ş, ğ, ü, ö and ç all work, because their diacritics really are combining marks. So the recipe looks about eighty percent correct. It passes review as "Turkish is handled", then fails on the first title containing an i.
The correct order
Turkish letters must be replaced through an explicit map BEFORE any decomposition runs. That is how this tool works: ı, İ, ğ, ş, ç, ö, ü and the circumflex vowels are substituted first, and only then is decomposition applied to catch the remaining European diacritics.
The same map covers the circumflex vowels in words like "rüzgâr" and "Kâğıthane". Left out, they fall through as hyphens exactly like the dotless ı.
Note
Letters with no decomposition
A second class of silent loss: ß, ø, ł, æ and þ are not accented forms, they are letters in their own right. Decomposition does not touch them and an ASCII filter deletes them.
Straße -> strae (ß deleted)Łódź -> odz (Ł deleted)Ærø -> r (Æ and ø deleted)This tool maps them explicitly as well: Strasse, Lodz, AEro. Rare on a Turkish site, but the kind of defect that takes an afternoon to track down the one time it happens.
Non-Latin scripts
A Japanese or Arabic title cannot become an ASCII slug. This tool returns an empty result and names the characters it removed, because the difference between "the tool is broken" and "your title is not in the Latin alphabet" determines what the visitor does next.
Length limits and word boundaries
Truncating a slug mid-word destroys the readability that is the entire point of having one. This tool breaks at the nearest separator instead, so no half word is left behind, and a word that fits the limit exactly is kept rather than discarded.
Nothing leaves your browser
What you type is never sent to a server. The conversion runs entirely in your browser, and once the page has loaded you can disconnect and it keeps working.
Frequently Asked Questions
- Why do other tools turn "Işık" into "is-k"?
- Because they decompose first and strip combining marks. The dotless ı has no decomposition, so it survives that step, and is then deleted for not being ASCII with a separator left in its place. The fix is to apply an explicit map before decomposing.
- Should I use hyphens or underscores?
- Hyphens for URL paths: search engines treat a hyphen as a word separator and an underscore as a word joiner. Underscores suit filenames and identifiers. This tool produces either.
- How long should a slug be?
- There is no technical limit, but 60 to 80 characters is a practical range for readability and sharing. Put the meaningful words first, since truncation removes from the end.
- Should I change a slug that is already published?
- Not unless you have to. Changing one requires a permanent redirect from the old URL, and without it inbound links break and the ranking resets. That is why producing the right slug the first time is worth the attention.
- Can I just use Turkish characters directly in a URL?
- Technically yes, through percent encoding. In practice the address becomes an unreadable string when copied, some older clients mangle it, and it looks untrustworthy when shared. An ASCII slug is still the right choice.
Tool and article by Mustafa Kürşad Başer, Senior Software Engineer. Published: August 2026.