“Switch the keyboard layout automatically” means different things depending on what should decide the layout. It can be the window you’re typing in, the app or website in front, or the physical keyboard under your hands. macOS covers the first; apps cover the rest. Pick by what decides the layout for you.
Every method at a glance
| Decides the layout | Built in | Good for | |
|---|---|---|---|
| Shortcut or Input menu | You, every time | Yes | Occasional switches |
| Per document | The window in front | Yes | One language per document |
| Input Source Pro | The app, or the website in a browser | No, free app | One keyboard, a language per app |
| Keyameleon | The keyboard you type on | No, free app | Keyboards with different printed layouts |
| Karabiner-Elements | Rules you write | No, free app | People who already customize their keyboard |
Built in: shortcuts and the Input menu
First add your layouts in System Settings › Keyboard › Text Input › Edit…. Then Control Space selects the previous input source, Control Option Space the next one, and the 🌐 key can be set to change input source in Keyboard settings. Nothing here is automatic, but it’s the baseline every other method builds on.
Built in: a layout per document
In the same Input Sources settings, turn on Automatically switch to a document’s input source. Each window then remembers the input source you last used in it, and macOS restores it when you come back. It’s the only automatic switching macOS has, and it suits people who write each document in one language.
Per app or website: Input Source Pro
Input Source Pro is a free, open-source app that sets a default input source for each app, and for each website in most browsers. English in the terminal, Chinese in WeChat, Japanese on one site. It also shows an on-screen indicator of the active input source. How it compares with Keyameleon.
Per keyboard: Keyameleon
If your keyboards have different layouts printed on them, say a US MacBook and a German external keyboard, neither the document nor the app is the right signal. The keyboard is. Keyameleon is a free, open-source menu bar app for macOS 26 or later: assign an input source to each keyboard once, and it switches when you start typing on one, in every app. The external keyboard guide walks through the whole setup.
Other per-keyboard options are Keychange, which runs on macOS 14 and later, and the command-line autokbisw.
Rules: Karabiner-Elements
Karabiner-Elements remaps keys with rules written in JSON, and a rule can select an input source, for example when a key comes from a given keyboard. It’s the most flexible option and the most work to set up. See Keyameleon vs Karabiner-Elements.
Pick one rule
All of these change the same system setting, so running two at once means they take turns overriding each other. Decide what should choose the layout (the window, the app or the keyboard) and use the one tool that follows that rule.