Type 日本語 on an English keyboard
する programs are written in Japanese, but you don’t need a Japanese keyboard. Every computer already has a Japanese input method (IME): you type the sound in Latin letters, and it turns hyouji into 表示. This page shows how to turn it on and the few keys you need. Then try the typing practice.
01What you need
Japanese uses three scripts: hiragana (あいう), katakana (アイウ) and kanji (表示). An IME lets you type the reading in romaji, shows it as hiragana, and converts it to kanji when you press Space. Nothing has to be downloaded on Windows or macOS; on Ubuntu you install one package.
You will switch between two modes all the time:
- Japanese mode (the indicator shows
あ): letters become kana. - English mode (the indicator shows
A): your keyboard works as usual.
Keep your English (US) keyboard layout. The Japanese IME sits on top of it.
02Windows
Set it up
- Open Settings → Time & language → Language & region.
- Click Add a language, choose 日本語 (Japanese) and install it. You don’t need to make it the display language. This adds Microsoft IME.
- Click ⋯ → Language options next to Japanese. Under Keyboard layout, choose English keyboard (101/102 key) and restart. Without this, Windows may assume a Japanese keyboard and your symbol keys type the wrong characters.
Switch modes
- Win + Space switches between the English and Japanese keyboards.
- Inside the Japanese keyboard, Alt + ` (the key left of 1) switches between
あandA. You can also click theA/あin the taskbar. - To use Ctrl + Space instead, open the Microsoft IME settings (right-click
A/あ→ Settings) and assign it under Key and touch customization.
03macOS
Set it up
- Open System Settings → Keyboard, and next to Input Sources click Edit….
- Click +, choose Japanese, then Romaji (not Kana, which needs a Japanese keyboard), and click Add.
- Keep ABC or U.S. in the list. In the Japanese source’s options you can turn off Live Conversion if you prefer to convert only when you press Space.
Switch modes
- Ctrl + Space switches to the previous input source, so it toggles between ABC and Japanese.
- On recent Macs, the 🌐 (fn) key can do the same: set Press 🌐 key to → Change Input Source in Keyboard settings.
- Or turn on Use the Caps Lock key to switch to and from ABC in the input source settings, and use Caps Lock.
04Ubuntu
Ubuntu’s desktop uses IBus, and the Japanese engine is Mozc (the open-source version of Google’s Japanese input).
Set it up (IBus, the default)
$ sudo apt install ibus-mozc- Log out and back in.
- Open Settings → Keyboard, click + Add Input Source, choose Japanese → Japanese (Mozc). Keep English (US) as well.
Switch modes
- Super + Space switches between English (US) and Mozc.
- If Mozc still types Latin letters, click the indicator in the top bar and choose Input Mode → Hiragana. In Mozc’s Tools → Properties → Keymap (package
mozc-utils-gui) you can add a key to turn it on and off.
Or with fcitx5
If you prefer fcitx5 (common on KDE), install fcitx5-mozc, run im-config -n fcitx5, log out, and add Mozc in the Fcitx configuration. Ctrl + Space then turns Japanese on and off.
$ sudo apt install fcitx5-mozc $ im-config -n fcitx5
05Typing in romaji
In Japanese mode, type the reading. It appears underlined. Then:
- Space converts it to kanji. Press Space again (or the arrow keys) to pick another candidate.
- Enter confirms the text. Pressing Enter without Space keeps it in hiragana.
- Esc cancels. Shift + ←/→ makes a segment shorter or longer when the IME splits a word in the wrong place.
- For katakana, press F7 before Enter (Windows and Mozc), or Ctrl + K on a Mac. On Windows and Mozc, F10 turns what you typed back into Latin letters.
Most readings are typed as they sound. These are the ones that trip people up:
| To get | Type | Why |
|---|---|---|
| を | wo | The particle is pronounced “o”, but o gives お. |
| は | ha | The particle とは is pronounced “to-wa” but typed toha. |
| ん | nn | A single n works before a consonant (kansuu → かんすう), but before a vowel, y or at the end, type nn: konnnichiha → こんにちは. |
| っ | tt, kk… | Double the next consonant: kitte → きって. |
| きゃ | kya | Small ゃゅょ follow a consonant + y. A lone small kana is x or l + kana: xtu → っ. |
| ー | - | The long-vowel mark in katakana: ke-ki → ケーキ. |
| ひょう | hyou | Long “o” is written おう: 表示 is hyouji, 以上 is ijou. |
06Brackets and punctuation
In Japanese mode, a few keys type Japanese symbols instead. These are the ones する uses:
| To get | Press | Used in する for |
|---|---|---|
| 「 」 | [ ] | strings: 「こんにちは」 |
| 『 』 | [ then Space | names that contain hiragana: 『おやつの数』 |
| 【 】 | [ then Space, or type kakko and convert | derivations and templates: 【JSON】 |
| ( ) | Shift + 9 0 | grouping; full-width and ASCII parentheses both work |
| 、 | , | a pause in the punctuation style |
| 。 | . | the end of a sentence in the punctuation style |
| × ÷ | type kakeru / waru and convert | multiplication and division |
ー and / types ・. Neither is minus or division in する. For arithmetic, switch to English mode (or use × and ÷). The same goes for Latin names like x: type them in English mode.07Typing a する program
Words in する are separated by spaces. In Japanese mode, Space converts, so press it once more after confirming to get a space. On Windows that space is the full-width by default; する accepts it just like an ASCII space, and it accepts full-width digits and +* too. So you can type a whole line without leaving Japanese mode:
値段 とは 1200 です 値段 * 2 「する」 を 表示する
2400 する
If you prefer ASCII spaces, the Microsoft IME setting General → Space can be set to Always half-width, and Shift + Space types the other width on Windows. Here is how some common words are typed:
| Word | Type | Meaning |
|---|---|---|
| 表示する | hyoujisuru | display |
| とは | toha | is defined as |
| です | desu | is (ends a definition) |
| を | wo | object particle |
| 加算する | kasansuru | add |
| 以下の手順です | ikanotejunndesu | the steps below are |
| 以上です | ijoudesu | that’s all (closes a block) |
If the IME picks the wrong kanji, press Space again and choose from the list. It remembers your choices, so the second time is faster. You can also add your own function names to its user dictionary.
08Let the editor type for you
You only need to type a name once. In VS Code with the する extension:
- Completion (Ctrl + Space) offers your functions and values, built-ins, the standard library and keywords. Type the first kanji, such as
表, and pick表示する. Names with hiragana are inserted already in『』. The list also appears on its own as you type, which helps on a Mac, where Ctrl + Space usually switches the input source. - Typing
(,「or『adds the closing bracket for you. - Hovering over a function shows which particles it takes, so you don’t have to look them up.
Comments and the names of your own variables can be in English, so you only switch to Japanese mode for the words of the language. Ready? Check yourself with the typing practice, go on to the tutorial, or try it in the playground.