A free, open-source converter that moves input method (IME) dictionaries between 50+ Chinese input method formats on Windows, Linux and macOS.
theajack/cnchar
A JavaScript/TypeScript utility library for Chinese characters, covering pinyin, stroke counts, radicals, idioms, stroke-order drawing and speech.
- Stars
- 3,107
- Forks
- 341
- Open issues
- 50
- Last commit
- 27 days ago
What is it?
cnchar is a Chinese character toolkit for JavaScript that lets developers look up pinyin (with tones, initials and finals), stroke counts, stroke order and radicals for characters. It also supports polyphonic characters and words, conversion between simplified, traditional and stylized Chinese text, and lookup of characters by pinyin or stroke count.
Beyond basic lookups, it provides plugins for idioms, two-part allegorical sayings (歇后语), word composition, dictionary explanations, and character drawing with animated stroke-by-stroke display built on HanziWriter. Speech synthesis and recognition are available through browser APIs, and pinyin/IME-related helpers are included.
The core library is split into optional plugin packages so projects can install only what they need. It runs in browsers, Node.js, WeChat mini programs and React Native-style environments, and is written in TypeScript.
Key features
- 01Get pinyin with tones, initials, finals and polyphonic character handling
- 02Look up stroke counts, stroke order and radicals for Chinese characters
- 03Convert between simplified, traditional and stylized Chinese text
- 04Find characters by pinyin or stroke count
- 05Query idioms, two-part sayings, word composition and explanations via plugins
- 06Draw characters stroke by stroke in the browser
Use cases
- Adding pinyin annotations to Chinese text in a web or Node.js app
- Sorting contact lists by pinyin or stroke count
- Building a Chinese character learning or typing game
- Creating a stroke-order practice tool for handwriting learners
Quick start
- 1
Install the core library with npm
npm i cnchar - 2
Use it in your code to get pinyin and strokes
Things to know
- Many advanced features need separate plugin packages to be installed.
- Dictionary data comes from online sources and the README admits it may contain errors or omissions.
In collections
Topics
FAQ
- What is cnchar?
- A JavaScript/TypeScript utility library for Chinese characters, covering pinyin, stroke counts, radicals, idioms, stroke-order drawing and speech. cnchar is a Chinese character toolkit for JavaScript that lets developers look up pinyin (with tones, initials and finals), stroke counts, stroke order and radicals for characters. It also supports polyphonic characters and words, conversion between simplified, traditional and stylized Chinese text, and lookup of characters by pinyin or stroke count.
- Is cnchar free to use? What license does it have?
- cnchar is open source under the MIT license. Check the license terms before using it in commercial products.
- Is cnchar still maintained?
- Actively maintained. The last commit to cnchar was on Oct 11, 2026.
- What can I use cnchar for?
- Adding pinyin annotations to Chinese text in a web or Node.js app Sorting contact lists by pinyin or stroke count Building a Chinese character learning or typing game Creating a stroke-order practice tool for handwriting learners
- How do I install cnchar?
- Install the core library with npm: npm i cnchar Use it in your code to get pinyin and strokes
- Where can I get cnchar?
- The source code and installation instructions are on GitHub: https://github.com/theajack/cnchar
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A single-page web tool that shows a Chinese character's oracle bone, small seal, traditional and simplified forms, plus pronunciation, Shuowen definition and phonetic family.
Encrypts text into classical-Chinese-style prose built from Chinese characters, using AES-256 encryption.
Turns any font into animated handwriting that draws itself stroke by stroke, for React, Vue, Svelte, Solid, Astro and vanilla JS.
Open-source pixel art editor built in Godot, offering tools for sprites, tilemaps, animations and spritesheet export.
A multimodal LLM that turns scientific figures and hand sketches into compilable TikZ/LaTeX graphics programs.