Skip to content

How to type accents on Linux (Compose key)

Set up a Compose key in GNOME or KDE and type é, ñ, ç, ß and ł from sequences you can guess. Plus Ctrl+Shift+U, the international layout and GNOME Characters.

Updated · 5 min read

Linux has the best accent system of any desktop platform and the worst discoverability. The Compose key turns character entry into something close to a small language: you press Compose, then two keys that look like what you want, and the character appears. No codes, no layout switching, no memorising numbers. Every sequence below was taken from the system Compose file that ships with X11, not from a blog, so they are exactly what your machine will do.

Turning on the Compose key

Nothing is enabled by default. Pick a key you never use: Right Alt, Right Ctrl, Caps Lock, the Menu key and Scroll Lock are the usual choices.

GNOME. Open Settings, then Keyboard. Under the section labelled Type Special Characters you will find Compose Key. Switch it on and choose your key.

KDE Plasma 6. Open System Settings, then Input and Output, then Keyboard, then Key Bindings. Tick Configure keyboard options, expand Position of Compose key, choose a key and apply. On Plasma 5 the same option lives under Input Devices, then Keyboard, then the Advanced tab.

Any X11 session from the command line. Run setxkbmap -option compose:ralt, substituting compose:rctrl, compose:caps or compose:menu as you prefer. On Debian and Ubuntu, make it permanent by setting XKBOPTIONS="compose:ralt" in /etc/default/keyboard.

How a sequence works

Press and release the Compose key. Then press the two other keys one after another. Nothing appears on screen until the sequence completes. Compose, then ', then e gives é.

Most accent sequences work in either order, so e then ' gives the same result. Ligatures and symbols usually do not, which is the main source of surprises.

CharacterSequenceCharacterSequence
á' then aåo then a
àbacktick then aæa then e
â^ then aœo then e
ä" then aø/ then o
ã~ then aç, then c
CharacterSequenceCharacterSequence
ñ~ then ną; then a
ßs then sę; then e
čc then cā- then a
šc then sł/ then l
žc then zż. then z

The same patterns generalise. The apostrophe is the acute, so ' with e, i, o, u, y, c, n, s or z gives the acute form of each. The backtick is the grave, the caret is the circumflex, the quote is the diaeresis, the tilde is the tilde, the comma is the cedilla, the semicolon is the ogonek, the hyphen is the macron and a leading c is the caron. That is nine accents to remember, not two hundred characters.

Punctuation and symbols follow the same logic.

CharacterSequenceCharacterSequence
¿? then ?©o then c
¡! then !®o then r
«< then <°o then o
»> then >…. then .
€= then e×x then x

Three hyphens in a row give an em dash; two hyphens and a full stop give an en dash.

Four traps worth knowing

Compose, equals, e is the euro, not ę. The ogonek lives on the semicolon or the comma. This one catches Polish typists constantly.

Compose, c, o is ǒ, not the copyright sign. The copyright sign is o then c. Order matters for symbols even though it usually does not for accents.

Compose, C, C is the double-struck mathematical C, not Č. The capital caron is a lowercase c followed by a capital C. Same for the others: c then S gives Š.

Compose, s, s is ß, and Compose, S, S is the capital ẞ. The capital form exists, which surprises people who only know the lowercase letter.

Ctrl+Shift+U for anything else

For characters with no memorable sequence, type the Unicode number instead. Press Ctrl+Shift+U, then the hex code, then Space or Enter. GNOME’s own wording is to press the shortcut and then type the four-character code.

Ctrl+Shift+U then e9 gives é; f1 gives ñ; df gives ß; 142 gives ł; 20ac gives the euro.

The catch is coverage. This shortcut is built into GTK, so it works in GNOME applications, Chromium, Firefox and Electron apps. Plain Qt and KDE applications only honour it when IBus or Fcitx5 is running as your input method framework. The Compose key has no such limitation, which is why it is the method to set up first.

The US international layout

If you want dead keys in the style of Windows or ChromeOS, add the layout instead. In GNOME go to Settings, then Keyboard, then Input Sources, then the plus button, then English, and pick the international variant. In KDE use System Settings, then Keyboard, then Layouts, then Add.

Two variants matter and they are easy to confuse. The plain international variant makes ', ", backtick, ~ and ^ into dead keys, so the apostrophe waits for a vowel. The AltGr variant moves those dead keys onto AltGr, leaving normal punctuation alone, which most English speakers prefer. The exact menu wording differs between distributions, so read the description rather than trusting a remembered label.

Either way, the right Alt key gives you direct characters: AltGr+E for é, AltGr+A for á, AltGr+N for ñ, AltGr+S for ß, AltGr+C for the copyright sign, AltGr+L for ø, AltGr+Z for æ, AltGr+K for œ, AltGr+comma for ç and AltGr+/ for ¿. Add Shift for the capitals. Note that ł is not on this layout at all; use Compose or the Unicode method.

GNOME Characters and KCharSelect

When you do not know what you are looking for, use the picker. GNOME Characters lets you search by keyword, browse categories, and copy a character with one click; it also shows the code point so you can learn the number for next time. Launch it from the Activities overview by typing “Characters”. The package is gnome-characters. On KDE the equivalent is KCharSelect, and the older gucharmap is still around on many systems.

If you move between machines, How to type accents on Windows (Alt codes and layouts) covers Alt codes, which require a numeric keypad with Num Lock on and exist only on Windows, and Alt codes for accented letters: the complete verified list has the verified list. How to type accents on a Mac (Option key and press-and-hold) covers the Option key method, and How to type accents on a Chromebook covers ChromeOS, which shares the Ctrl+Shift+U shortcut with Linux. The US International keyboard layout explained goes deeper into the dead key layout. For Polish, Czech and Swedish the per-language pages list which letters you actually need. Developers can find the entity and escape forms in HTML entity, Unicode and CSS codes for accented letters, and Remove accents from text strips diacritics from a block of text when a legacy system will not take them.

FAQ

What is a Compose key?

A key you designate yourself, often Right Alt or Caps Lock, that starts a short sequence. Press Compose, then the apostrophe, then E, and you get é. The sequences are defined in a system file and work in every application.

Does Compose then equals then E give ę?

No, it gives the euro sign. The ogonek is on the semicolon or the comma, so Compose then semicolon then E gives ę.

Why does Ctrl+Shift+U do nothing in my KDE application?

That shortcut is built into GTK. Qt applications only support it when an input method framework such as IBus or Fcitx5 is running. The Compose key works everywhere, which is why it is the better default.

How do I type Č rather than č?

Use Compose, then a lowercase c, then a capital C. Two capital Cs give the double-struck mathematical symbol instead, which is a common surprise.

Do Windows Alt codes work on Linux?

No. Alt codes are a Windows feature that needs a numeric keypad with Num Lock on. Linux uses the Compose key, Ctrl+Shift+U or a keyboard layout with dead keys.

By language: Spanish, French, German, Polish, Czech, Swedish