Japanese text frequently mixes full-width (zenkaku) and half-width (hankaku) characters, which breaks search and data consistency. This converter normalises ASCII and katakana between the two widths using the correct Unicode mappings.
Why full-width and half-width coexist in Japanese text
Traditional Japanese typesetting allocated a fixed square cell to every character — kanji, hiragana, katakana all occupy one square. When ASCII was incorporated into Japanese character sets, two versions emerged: a half-width form that took half a cell (matching standard ASCII), and a full-width form that took a full cell, fitting neatly in mixed Japanese-ASCII layouts.
Over decades, both versions ended up encoded in Unicode:
- Half-width ASCII is the familiar
U+0021..U+007Erange — the ordinary keyboard characters. - Full-width ASCII is a parallel block at
U+FF01..U+FF5E— visually wider, as inA,B,1,2. - Half-width katakana lives at
U+FF61..U+FF9F— a legacy encoding used in older systems like JIS X 0201. - Full-width katakana is the standard modern form in the
U+30A0..U+30FFblock.
Text from legacy databases, OCR output, or older Japanese web pages often mixes these freely. When a user types A and your database stores A, a search for one misses the other entirely.
How the conversion works
Full-width ASCII is a clean offset of plain ASCII, so the conversion is arithmetic rather than a lookup table:
full-width ASCII U+FF01..U+FF5E = ASCII U+0021..U+007E + 0xFEE0
full-width space U+3000 <-> half-width space U+0020
half-width katakana U+FF61..U+FF9F -> full-width katakana (table)
カ + ゙ (dakuten) -> ガ
ハ + ゚ (handakuten) -> パ
To go from full-width to half-width, subtract 0xFEE0; to go the other way, add it. For half-width katakana the tool uses a mapping table and looks ahead one character to recombine a trailing voiced or semi-voiced mark into the single composed kana.
Dakuten and handakuten: the tricky part
Half-width katakana represents voiced sounds (like ガ) as two separate characters: the base kana (カ) followed by a combining mark (゙). When converting to full-width, these two characters must be merged into a single precomposed code point (ガ). If you skip this step and convert each code point independently, you end up with カ゛ — two characters that look like the voiced kana but are not the same Unicode character, causing subtle mismatches in search and sort.
The tool handles this by peeking at the character after each base kana and consuming the combining mark if it is present.
Practical examples
| Input | Direction | Output | Notes |
|---|---|---|---|
Hello 2026 | Full→Half | Hello 2026 | Full-width letters and space |
ガイド | Half→Full | ガイド | Dakuten recombined |
テスト | Half→Full | テスト | Plain half-width katakana |
Hello | Half→Full | Hello | Standard ASCII widened |
When to use each direction
Normalise to half-width ASCII + full-width katakana before indexing user input or storing in a database. This gives a single canonical form so that A and A match, and テスト and テスト match.
Normalise to full-width when preparing text for display in a Japanese context where consistent character-cell width matters — for example, generating fixed-width terminal output or preparing text for a legacy system that expects zenkaku.
Apply the same normalisation to both the stored data and the search query to ensure symmetric matching.