WANAKANA.js Mobile-friendly and lightweight
Japanese Hiragana & Katakana IME

Download Version
View project on GitHub
var input = document.getElementById('ime');

Additional functions



View the extended API including extra conversion and checking methods.

Quick Usage

Function Usage
wanakana.bind( element [, options] ) Automatically bind IME (toKana) functionality to a form textarea or input.
wanakana.unbind( element ) Unbind IME from element.
wanakana.isKana( string ) Returns true if string contains only Hiragana and/or Katakana.
wanakana.isHiragana( string ) Returns false if string contains mixed characters, otherwise true if Hiragana.
wanakana.isKatakana( string ) Returns false if string contains mixed characters, otherwise true if Katakana.
wanakana.toKana( string [, options] ) Convert Romaji to Kana. outputs Hiragana by default; uppercase text outputs Katakana.
wanakana.toHiragana( string [, options] ) Convert Katakana or Romaji to Hiragana.
wanakana.toKatakana( string [, options] ) Convert Hiragana or Romaji to Katakana.
wanakana.toRomaji( string [, options] ) Convert Kana to Romaji.
wanakana.stripOkurigana( string [, options] ) Remove trailing kana.
wanakana.tokenize( string [, options] ) Split text into language/kana tokens.
options = {
IMEMode: false, useObsoleteKana: false passRomaji: false, upcaseKatakana: false, customKanaMapping: {}, customRomajiMapping: {} }

IMEMode: Set true, 'toHiragana', or 'toKatakana' to convert input from a text input as it is typed.

useObsoleteKana: Set true to use obsolete characters, such as and

passRomaji: Pass through romaji when using toKatakana() or toHiragana()

upcaseKatakana: Convert katakana to uppercase when using toRomaji()

customKanaMapping: custom map to be merged with default in toKana()

customRomajiMapping: custom map to be merged with default in toRomaji()

Community Library Ports

Language Library Name
Python WanaKanaPython
Java WanaKanaJava
Rust WanaKanaRust
Swift WanaKanaSwift