# @sindresorhus/transliterate

> Convert Unicode characters to Latin characters using transliteration

Latest version **2.3.1** (published 2026-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sindresorhus/transliterate
pnpm add @sindresorhus/transliterate
yarn add @sindresorhus/transliterate
bun add @sindresorhus/transliterate
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.3.1 |
| Published | 2026-01-08 |
| First published | 2020-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 42.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 320 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | transliterate, transliteration, string, deburr, unicode, ascii, text, latin, latinize, convert, replace |

## Links

- npm: https://www.npmjs.com/package/@sindresorhus/transliterate
- Repository: https://github.com/sindresorhus/transliterate
- Homepage: https://github.com/sindresorhus/transliterate#readme
- Issues: https://github.com/sindresorhus/transliterate/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/@sindresorhus/transliterate

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 2.3.1 (latest) — 2026-01-08
- 2.3.0 — 2025-12-22
- 2.2.0 — 2025-10-17
- 2.1.0 — 2025-10-13
- 2.0.0 — 2025-09-11
- 1.6.0 — 2022-12-09
- 1.5.0 — 2021-10-19
- 1.4.0 — 2021-08-23
- 1.3.0 — 2021-07-06
- 1.2.1 — 2021-06-02
- 1.2.0 — 2021-05-05
- 1.1.0 — 2021-05-04
- 1.0.0 — 2021-04-18
- 0.1.2 — 2021-03-31
- 0.1.1 — 2020-06-06
- … 1 more at https://npm.io/package/@sindresorhus/transliterate/versions

## README

# transliterate

> Convert Unicode characters to Latin characters using [transliteration](https://en.wikipedia.org/wiki/Transliteration)

Can be useful for [slugification](https://github.com/sindresorhus/slugify) purposes and other times you cannot use Unicode.

## Install

```sh
npm install @sindresorhus/transliterate
```

## Usage

```js
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'
```

## API

### transliterate(string, options?)

#### string

Type: `string`

String to transliterate.

#### options

Type: `object`

##### customReplacements

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.

```js
import transliterate from '@sindresorhus/transliterate';

transliterate('Я люблю единорогов', {
	customReplacements: [
		['единорогов', '🦄']
	]
})
//=> 'Ya lyublyu 🦄'
```

You can also pass a `Map`:

```js
transliterate('foo & bar', {
	customReplacements: new Map([
		['&', 'and']
	])
})
//=> 'foo and bar'
```

##### locale

Type: `string`

[BCP-47](https://developer.mozilla.org/en-US/docs/Glossary/BCP_47_language_tag) language tag for language-specific transliteration.

When specified, uses language-specific replacement rules for characters that have different transliterations in different languages.

```js
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'
```

### Supported locales

The following locales have specific replacement rules when using the `locale` option:

- `da` - Danish
- `de` - German
- `hu` - Hungarian
- `nb` - Norwegian Bokmål
- `sr` - Serbian
- `sv` - Swedish
- `tr` - Turkish

## Supported languages

Most major languages are supported.

This includes special handling for:

- Arabic
- Armenian
- Czech
- Danish
- Dhivehi
- Georgian
- German (umlauts)
- Greek
- Hungarian
- Latin
- Latvian
- Lithuanian
- Macedonian
- Pashto
- Persian
- Polish
- Romanian
- Russian
- Serbian
- Slovak
- Swedish
- Turkish
- Ukrainian
- Urdu
- Vietnamese

However, Chinese is [currently not supported](https://github.com/sindresorhus/transliterate/issues/1).

## Related

- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string

---
_Source: https://npm.io/package/@sindresorhus/transliterate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
