The Chinese Pinyin Annotator places the romanised reading of each Simplified Chinese character directly above it, using the same ruby layout found in learner textbooks and graded readers. Paste a sentence and instantly see how it should be pronounced, tone marks and all — a fast way to bridge the gap between recognising characters and saying them aloud.
How it works
Each character in your text is looked up in a built-in dictionary that maps it to its Hanyu Pinyin reading, complete with the diacritic that encodes the tone. The annotator wraps every matched character in an HTML <ruby> element with the pinyin inside an <rt> (ruby text) tag, which the browser positions above the base character. Characters that are not in the dictionary — and any non-Chinese text such as punctuation — pass through unchanged so the original layout is preserved.
The four Mandarin tones are written as ā á ǎ à over the main vowel of each syllable, following the standard tone-placement rules. A syllable with no diacritic is read in the neutral (light) tone.
Understanding Mandarin tones
Each Chinese syllable carries one of four tones (or a neutral tone), and tones are phonemic — they change the word’s meaning entirely. The four tones on the syllable “ma” alone give four unrelated words:
| Diacritic | Tone | Description | Example |
|---|---|---|---|
| ā | 1st (flat) | High, level, held steady | 妈 (mother) |
| á | 2nd (rising) | Starts mid, rises sharply | 麻 (hemp, numb) |
| ǎ | 3rd (dipping) | Falls then rises | 马 (horse) |
| à | 4th (falling) | Starts high, drops sharply | 骂 (to scold) |
| a | Neutral | Short, unstressed | 吗 (question particle) |
The diacritic always sits above the main vowel of the syllable. When multiple vowels appear together (e.g. “ou”, “ui”), tone-placement rules decide which vowel carries the mark — generally the one pronounced most prominently.
Tone placement rules
Standard Hanyu Pinyin tone placement follows these priorities:
- If the syllable contains a or e, the diacritic goes there.
- If the syllable contains ou, the diacritic goes on o.
- Otherwise the diacritic goes on the last vowel.
The annotator applies these rules automatically, so guó places the mark on o and huì places it on i.
Heteronyms and when to verify manually
Many Chinese characters have two or more valid readings depending on context, known as heteronyms (多音字). A few common examples:
- 行 —
xíng(to walk, acceptable) orháng(a row, a profession, a bank) - 长 —
cháng(long) orzhǎng(to grow, a senior person) - 发 —
fā(to send, to emit) orfà(hair) - 乐 —
lè(happy) oryuè(music)
The annotator always renders the most frequent reading for each character. When you are working with text where these words appear in the less common sense, verify that syllable manually. The coverage counter shows how many characters were matched, so you can spot gaps quickly.
Use cases
Pinyin annotation is most valuable for: learner handouts and textbook extracts where students need pronunciation support; creating subtitles or captions for Mandarin video; annotating song lyrics or poems for performance; and proofreading text-to-speech scripts to catch unusual readings before recording. Everything runs locally in your browser — private documents are safe.