# get-east-asian-width

> Determine the East Asian Width of a Unicode character

Latest version **1.7.0** (published 2026-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-east-asian-width
pnpm add get-east-asian-width
yarn add get-east-asian-width
bun add get-east-asian-width
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2026-09-17 |
| First published | 2023-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 54 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | unicode, east-asian-width, eastasianwidth, character, string, width, text, layout, alignment, fullwidth, halfwidth, ambiguous, narrow, wide, neutral, typography, japanese, chinese, korean, codepoint, text-processing, i18n, l10n |

## Links

- npm: https://www.npmjs.com/package/get-east-asian-width
- Repository: https://github.com/sindresorhus/get-east-asian-width
- Homepage: https://github.com/sindresorhus/get-east-asian-width#readme
- Issues: https://github.com/sindresorhus/get-east-asian-width/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/get-east-asian-width

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.7.0 (latest) — 2026-09-17
- 1.6.0 — 2026-05-08
- 1.5.0 — 2026-02-18
- 1.4.0 — 2025-09-09
- 1.3.1 — 2025-08-30
- 1.3.0 — 2024-10-13
- 1.2.0 — 2023-10-29
- 1.1.0 — 2023-10-29
- 1.0.0 — 2023-10-28

## README

# get-east-asian-width

> Determine the [East Asian Width](https://unicode.org/reports/tr11/) of a Unicode character

> East Asian Width categorizes Unicode characters based on their occupied space in East Asian typography, which helps in text layout and alignment, particularly in languages like Japanese, Chinese, and Korean.

Unlike other similar packages, this package uses the latest Unicode data (which changes each year).

## Install

```sh
npm install get-east-asian-width
```

## Usage

```js
import {eastAsianWidth, eastAsianWidthType} from 'get-east-asian-width';

const codePoint = '字'.codePointAt(0);

console.log(eastAsianWidth(codePoint));
//=> 2

console.log(eastAsianWidthType(codePoint));
//=> 'wide'
```

## `eastAsianWidth(codePoint: number, options?: object): 1 | 2`

Returns the width as a number for the given code point.

### options

Type: `object`

#### ambiguousAsWide

Type: `boolean`\
Default: `false`

Whether to treat an `'ambiguous'` character as wide.

```js
import {eastAsianWidth} from 'get-east-asian-width';

const codePoint = '⛣'.codePointAt(0);

console.log(eastAsianWidth(codePoint));
//=> 1

console.log(eastAsianWidth(codePoint, {ambiguousAsWide: true}));
//=> 2
```

> Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). **If the context cannot be established reliably, they should be treated as narrow characters by default.**
> - http://www.unicode.org/reports/tr11/

## `eastAsianWidthType(codePoint: number): 'fullwidth' | 'halfwidth' | 'wide' | 'narrow' | 'neutral' | 'ambiguous'`

Returns the type of “East Asian Width” for the given code point.

## Related

- [string-width](https://github.com/sindresorhus/string-width) - Get the visual width of a string

---
_Source: https://npm.io/package/get-east-asian-width · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
