
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@sindresorhus/transliterate
Advanced tools
Convert Unicode characters to Latin characters using transliteration
Convert Unicode characters to Latin characters using transliteration
Can be useful for slugification purposes and other times you cannot use Unicode.
npm install @sindresorhus/transliterate
import transliterate from '@sindresorhus/transliterate';
transliterate('Fußgängerübergänge');
//=> 'Fussgaengeruebergaenge'
transliterate('Я люблю единорогов');
//=> 'Ya lyublyu edinorogov'
transliterate('أنا أحب حيدات');
//=> 'ana ahb hydat'
transliterate('tôi yêu những chú kỳ lân');
//=> 'toi yeu nhung chu ky lan'
transliterate('En–dashes and em—dashes are normalized');
//=> 'En-dashes and em-dashes are normalized'
Type: string
String to transliterate.
Type: object
Type: Array<string[]> | Map<string, string>
Default: []
Add your own custom replacements.
The replacements are run on the original string before any other transformations.
This only overrides a default replacement if you set an item with the same key.
import transliterate from '@sindresorhus/transliterate';
transliterate('Я люблю единорогов', {
customReplacements: [
['единорогов', '🦄']
]
})
//=> 'Ya lyublyu 🦄'
You can also pass a Map:
transliterate('foo & bar', {
customReplacements: new Map([
['&', 'and']
])
})
//=> 'foo and bar'
Type: string
BCP-47 language tag for language-specific transliteration.
When specified, uses language-specific replacement rules for characters that have different transliterations in different languages.
import transliterate from '@sindresorhus/transliterate';
// Swedish: ä→a, ö→o, å→a
transliterate('Räksmörgås', {locale: 'sv'});
//=> 'Raksmorgas'
// German: ä→ae, ö→oe
transliterate('Räksmörgås', {locale: 'de'});
//=> 'Raeksmoergas'
The following locales have specific replacement rules when using the locale option:
da - Danishde - Germanhu - Hungariannb - Norwegian Bokmålsr - Serbiansv - Swedishtr - TurkishMost major languages are supported.
This includes special handling for:
However, Chinese is currently not supported.
The 'transliteration' package provides similar functionality for converting Unicode strings to ASCII. It also supports custom replacement maps and slugification. Compared to @sindresorhus/transliterate, it offers a more extensive set of default transliterations and additional configuration options.
The 'unidecode' package is another alternative for transliterating Unicode strings to ASCII. It is based on the Python Unidecode library and provides a straightforward way to convert non-Latin scripts. While it is effective, it may not offer as much customization as @sindresorhus/transliterate.
The 'slugify' package focuses on creating URL-friendly slugs from strings, including Unicode strings. It provides a range of options for customization and is highly performant. While it specializes in slug creation, it may not offer the same level of general transliteration functionality as @sindresorhus/transliterate.
FAQs
Convert Unicode characters to Latin characters using transliteration
The npm package @sindresorhus/transliterate receives a total of 2,387,673 weekly downloads. As such, @sindresorhus/transliterate popularity was classified as popular.
We found that @sindresorhus/transliterate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.