How It WorksPublished 9 min read

How to Show Ruby (Furigana) and Emphasis Dots in HTML: ruby, rt, rp Tags and text-emphasis

To add furigana (reading aids) on a web page, use the HTML <ruby> element; to add Japanese emphasis dots (bōten, also called kenten), use the CSS text-emphasis property. Both work in today’s major browsers and place the annotations correctly in horizontal and vertical text without images or stand-in symbols. This guide explains what <ruby>, <rt> and <rp> do and how to write them, the difference between group ruby and per-character ruby, the CSS for emphasis dots and the dot styles available, settings for vertical text, and how to keep line spacing even, with examples you can copy.

The basics of <ruby>, <rt> and <rp>

In HTML, ruby is written by wrapping the base text and its reading in a <ruby> element and putting the reading inside an <rt> element. The shortest form is “<ruby>漢字<rt>kanji</rt></ruby>”, and the browser shows a small “kanji” above 漢字 (to the right of it in vertical text).

TagRoleWhere it goes
<ruby>Wraps the whole ruby unitAround the base text and the reading
<rt>The reading (the ruby text)Right after the base text
<rp>Puts the reading in parentheses where ruby isn’t supportedA “(” and “)” placed before and after the <rt>
<rb> / <rtc>Groups of base text / ruby textNot used in the current HTML standard (an older style)

<rp> is hidden in browsers that can render ruby and only appears where ruby can’t be displayed (some email clients, text extraction and so on). If you write “<ruby>漢字<rp>(</rp><rt>kanji</rt><rp>)</rp></ruby>”, an environment without ruby support shows “漢字(kanji)”, which prevents the reading from running into the text as “漢字kanji”.

Group ruby and mono ruby (one reading per character)

Group ruby puts one reading over a whole word, while mono ruby gives each character its own reading, and the HTML is written differently. For mono ruby, you alternate base characters and <rt> elements.

TypeHTMLBest for
Group ruby<ruby>黄昏<rt>tasogare</rt></ruby>Words whose reading can’t be split per character: special compound readings (jukujikun), creative readings, character names
Mono ruby<ruby>漢<rt>kan</rt>字<rt>ji</rt></ruby>Teaching materials and children’s text, where you want to show the reading of each character

With mono ruby, the reading moves with each character even when a word breaks at the end of a line, which reads well on the web where line breaks fall wherever the screen width puts them. On the other hand, words like 黄昏 (tasogare, “dusk”) or 今日 (kyō, “today”), whose reading belongs to the word as a whole, can only be written as group ruby.

Add emphasis dots with CSS text-emphasis

Emphasis dots are visual emphasis rather than part of the meaning of the characters, so in HTML you mark the emphasis with a tag and draw the dots with CSS. The standard approach is to use the <em> element, which carries the meaning of emphasis, cancel its italics and then set text-emphasis.

The HTML is “<em class="bouten">禁書</em>” and the CSS is “em.bouten { font-style: normal; -webkit-text-emphasis: filled sesame; text-emphasis: filled sesame; }”. The -webkit- line is a fallback for older Safari and Chrome.

text-emphasis valueAppearanceTypical use
filled sesameBlack sesame dot ﹅The standard emphasis dot for Japanese, vertical or horizontal
open sesameWhite sesame dot ﹆Open (white) sesame dots
filled dotSmall black dot •Light emphasis in horizontal text
filled circle / open circleLarger black or white circleCircle dots and open circle dots
Any single character such as "★"The character you specifySpecial effects

CSS for ruby position, line spacing and vertical text

  • Use generous line spacing: set the body text’s line-height to around 1.8–2 so that lines with ruby don’t become taller than the rest and make the spacing uneven.
  • Ruby size: <rt> defaults to about half the size of the base text. If it’s too small, adjust it with something like rt { font-size: 0.55em; }.
  • Ruby below the text: ruby-position: under; shows horizontal ruby below the base text.
  • Vertical text: set writing-mode: vertical-rl; on the element around the text, and ruby and emphasis dots move to the right of the characters automatically.
  • Emphasis dot position: text-emphasis-position sets above/below in horizontal text and left/right in vertical text. For Japanese, over right (above in horizontal text, right in vertical text) is the norm.
  • Numbers in vertical text: to set a two-digit number sideways in one cell, use text-combine-upright: all;.

Support for values such as ruby-position: inter-character (ruby beside the character, as with Taiwanese Zhuyin) varies between browsers. Check the result in your target browsers before relying on it.

How ruby affects copying, screen readers and search

The reading inside <rt> is ordinary HTML text, so it is treated as part of the page’s text. Depending on how you use it, the following can happen.

  • Copying may paste the reading too: depending on the browser, you may get “黄昏tasogare” or “黄昏(tasogare)”. With <rp> in place you get the parenthesized form, which makes it easy to tell which part is the reading.
  • Screen readers may read the base text and then the reading: in some environments heavy ruby is read twice, as in “tasogare tasogare”. For teaching materials and similar content, it’s worth checking with an actual screen reader.
  • Use ruby only where it’s needed: putting ruby on every kanji adds a lot of text to the page and makes it harder to read. Limit it to difficult words and proper nouns.

If the page shows strings like “&lt;ruby&gt;” as visible text, the tags have been escaped as text. In a blog editor, paste into the HTML editing mode, not the visual editor.

Convert a novel manuscript to HTML ruby and emphasis dots in one go

When you publish a novel written in Narō, Kakuyomu or pixiv markup on a website or blog, rewriting every ruby and emphasis dot as tags by hand isn’t realistic. Paste the text into the Novel Ruby & Emphasis Dot Converter and choose “HTML” as the target format to rewrite it all at once.

  • Ruby becomes <ruby> and <rt>, and emphasis dots become <em class="bouten">. “Copy emphasis dot CSS” copies the text-emphasis CSS introduced in this article.
  • With “Include <rp>” selected, the output shows as “漢字(kanji)”-style parentheses where ruby isn’t supported.
  • Line breaks can be output as <br /> or, with “Wrap each line in a <p> paragraph”, as paragraphs.
  • It can also read HTML <ruby> and turn it back into Narō, Kakuyomu or pixiv markup, including mono ruby.

How HTML maps to the other formats is summarized in How to fix ruby that breaks when you repost a novel.

FAQ

How do I add furigana in HTML?
Wrap the base text and reading in <ruby>, put the reading in <rt>, and write “<ruby>漢字<rt>kanji</rt></ruby>”. If you place <rp>(</rp> and <rp>)</rp> before and after the <rt>, environments without ruby support show the reading in parentheses.
Do I need the rp tag?
Today’s major browsers support ruby, so the display won’t break without it. But it keeps the reading from running into the text when ruby isn’t supported or the text is extracted, so including it is the safe choice.
How do I add emphasis dots with CSS?
Wrap the characters in an element such as <em> and set “text-emphasis: filled sesame;”. When you use <em>, cancel the italics with font-style: normal; and also write -webkit-text-emphasis for older browsers.
How do I show ruby on the right side in vertical text?
Set writing-mode: vertical-rl; on the element around the text, and ruby automatically appears to the right of the characters. Emphasis dots move to the right in the same way.
Should I avoid the rb tag?
The current HTML standard treats <rb> and <rtc> as elements not to use. Write the base text directly inside <ruby>, and for per-character ruby, alternate base characters and <rt> elements.

Tools in this article

Related articles

How-to Guide8 min read

How to Add Ruby on Narō: Using the Vertical Bar |, Emphasis Dots, and Parentheses That Turn into Ruby

On Shōsetsuka ni Narō, you add ruby (furigana) simply by writing “|漢字《kanji》” in your text. But it’s also markup that trips people up all the time: leaving out the vertical bar (|) shifts where the ruby lands, including okurigana makes the 《》 show up as is, and a parenthesized aside after a name turns into furigana. This guide covers Narō’s three ruby styles and how far the base text extends in each, when the bar is required, how to add emphasis dots when there is no dedicated syntax, and how to fix parentheses and 《》 that become ruby by accident.

Read article →
How-to Guide8 min read

Ruby and Emphasis Dots on Kakuyomu: 《《》》 for Dots and |《 to Show the Bracket Itself

On Kakuyomu, ruby (furigana) is written as “|漢字《kanji》” and emphasis dots (bōten) as “《《傍点》》”. It looks a lot like Shōsetsuka ni Narō, but there are differences: Kakuyomu has dedicated emphasis-dot markup, parentheses never become ruby, and you can display a 《 that isn’t ruby by writing “|《”. This guide covers Kakuyomu’s ruby and emphasis dot syntax, when you can and can’t omit the vertical bar, how to use 《》 for epithets and in-story book titles, and how to convert between Kakuyomu, Narō and pixiv without breaking anything.

Read article →
How-to Guide8 min read

Ruby and Emphasis Dots in pixiv Novels: Writing [[rb:]] and Bulk-Converting from Narō and Kakuyomu

Ruby in pixiv novels is written as “[[rb:漢字 > kanji]]”. It’s completely different from Narō and Kakuyomu’s “|漢字《kanji》”, so when you repost a work, the 《》 shows up as raw symbols. pixiv also has no dedicated emphasis dot syntax, and the standard workaround is a middle-dot ruby on each character. This guide explains how to write ruby and emphasis dots in pixiv novels, how they coexist with other special tags such as [newpage], and how to convert ruby between pixiv, Narō and Kakuyomu in bulk without breaking it.

Read article →