Remove Accents & Slugify
Strip diacritics, build a URL-safe slug, or change the case — with a character count.
Enter some text to see the result.
How it works
Accented letters are stored in Unicode in two ways. The precomposed form stores "ế" as a single character; the decomposed form stores it as "e" plus two separate marks — a circumflex and an acute. Both look identical on screen and are different byte sequences, which is why stripping accents with a hand-written find-and-replace table always misses cases.
The correct approach is to normalise to the decomposed form first — JavaScript’s `normalize("NFD")` — then delete every combining mark in the U+0300–U+036F range. "ế", "ộ" and "ữ" each split into a base letter and their marks, and only the letter survives.
One letter defeats this: Đ. Unicode has no decomposed form for it, because it is not "D plus a mark" but a letter in its own right. Đ and đ have to be mapped to D and d by hand before normalising. Almost every accent-stripping snippet you will find online misses exactly this.
For a slug, everything that is not an ASCII letter or digit collapses into a single separator, and separators at either end are trimmed. Without that trim, a sentence ending in a full stop produces a slug with a trailing dash — which is not a valid URL segment.
Formula
strip = map Đ→D, đ→d → normalize("NFD") → delete characters in U+0300–U+036F
U+0300–U+036F is the Combining Diacritical Marks block. Targeting that block rather than every Unicode mark means text in Devanagari or Japanese comes back untouched instead of mangled.
Worked example
Turning "Đổi lịch âm dương" into a slug:
- Original
- Đổi lịch âm dương
- After mapping Đ
- Dổi lịch âm dương
- After NFD and mark removal
- Doi lich am duong
- Collapsed and lowercased
- doi-lich-am-duong
Skip the Đ mapping and you get "Đoi-lich-am-duong" — a non-ASCII letter in the middle of a slug, which forces percent-encoding and no longer matches the path being served.
Frequently asked questions
Why does Đ need special handling?
Because in Unicode it is a distinct letter, not a D with a mark, and so it has no decomposed form for normalisation to split. A small hand-written mapping is the only correct fix.
What is a slug, and why does it matter?
It is the readable part of a URL path, such as /remove-accents. It should be lowercase letters, digits and hyphens only, because every other character has to be percent-encoded — which makes the URL ugly and fragile when copied.
What is the difference between camelCase, snake_case and kebab-case?
Only how the words are joined: camelCase capitalises every word but the first, snake_case joins with underscores, kebab-case with hyphens. They are naming conventions in code, and which one to use depends on the language and project.
Why do the programming cases strip accents but Title Case does not?
camelCase, PascalCase, snake_case and CONSTANT_CASE produce identifiers, and very few places accept an identifier with a diacritic. Title case and sentence case are prose, where the marks belong.
How does the character count handle emoji?
One emoji counts as one character. JavaScript’s default length property counts most of them as two, because they occupy two UTF-16 code units — and platform character limits count real characters.
Is the text I paste sent anywhere?
No. Every conversion runs in JavaScript on your device. This site is a set of static files with no server to receive what you type.