Emacs keyboard shortcuts
GNU Emacs is the extensible editor built around Control and Meta key chords. Meta is Alt on Windows and Linux and Option on a Mac.
Most used Emacs keyboard shortcuts
The Emacs shortcuts worth learning first. The full list follows, grouped by task.
- Open (find) a fileMacCtrlX,CtrlFWindowsCtrlX,CtrlFLinuxCtrlX,CtrlF
- Save the bufferMacCtrlX,CtrlSWindowsCtrlX,CtrlSLinuxCtrlX,CtrlS
- Quit EmacsMacCtrlX,CtrlCWindowsCtrlX,CtrlCLinuxCtrlX,CtrlC
- Cancel the current commandMacCtrlGWindowsCtrlGLinuxCtrlG
- Run a command by nameMacOptionXWindowsAltXLinuxAltX
- UndoMacCtrl/orCtrlX,UWindowsCtrl/orCtrlX,ULinuxCtrl/orCtrlX,U
- Kill to the end of the lineMacCtrlKWindowsCtrlKLinuxCtrlK
- Paste (yank)MacCtrlYWindowsCtrlYLinuxCtrlY
- Set the mark (start a selection)MacCtrlSpaceWindowsCtrlSpaceLinuxCtrlSpace
- Search forward as you typeMacCtrlSWindowsCtrlSLinuxCtrlS
- Switch to another bufferMacCtrlX,BWindowsCtrlX,BLinuxCtrlX,B
- Go to the other windowMacCtrlX,OWindowsCtrlX,OLinuxCtrlX,O
Files and buffers
8 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Open (find) a file | CtrlX,CtrlF | CtrlX,CtrlF | CtrlX,CtrlF |
| Save the buffer | CtrlX,CtrlS | CtrlX,CtrlS | CtrlX,CtrlS |
| Save as (write file) | CtrlX,CtrlW | CtrlX,CtrlW | CtrlX,CtrlW |
| Save all buffers | CtrlX,S | CtrlX,S | CtrlX,S |
| Switch to another buffer | CtrlX,B | CtrlX,B | CtrlX,B |
| List all buffers | CtrlX,CtrlB | CtrlX,CtrlB | CtrlX,CtrlB |
| Close (kill) a buffer | CtrlX,K | CtrlX,K | CtrlX,K |
| Quit Emacs | CtrlX,CtrlC | CtrlX,CtrlC | CtrlX,CtrlC |
Commands
5 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Run a command by name | OptionX | AltX | AltX |
| Cancel the current command | CtrlG | CtrlG | CtrlG |
| Undo | Ctrl/orCtrlX,U | Ctrl/orCtrlX,U | Ctrl/orCtrlX,U |
| Redo| GUI Emacs; terminals cannot send this key. | CtrlShift/ | CtrlShift/ | CtrlShift/ |
| Repeat or modify the next command | CtrlU | CtrlU | CtrlU |
Moving
16 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Forward one character | CtrlF | CtrlF | CtrlF |
| Back one character | CtrlB | CtrlB | CtrlB |
| Next line | CtrlN | CtrlN | CtrlN |
| Previous line | CtrlP | CtrlP | CtrlP |
| Forward one word | OptionF | AltF | AltF |
| Back one word | OptionB | AltB | AltB |
| Start of the line | CtrlA | CtrlA | CtrlA |
| End of the line | CtrlE | CtrlE | CtrlE |
| Start of the buffer | OptionShift, | AltShift, | AltShift, |
| End of the buffer | OptionShift. | AltShift. | AltShift. |
| Scroll down a screen | CtrlV | CtrlV | CtrlV |
| Scroll up a screen | OptionV | AltV | AltV |
| Recenter the screen on the cursor | CtrlL | CtrlL | CtrlL |
| Go to a line number | OptionG,G | AltG,G | AltG,G |
| Forward one paragraph | OptionShift] | AltShift] | AltShift] |
| Back one paragraph | OptionShift[ | AltShift[ | AltShift[ |
Editing
19 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Delete the next character | CtrlD | CtrlD | CtrlD |
| Delete (kill) the next word | OptionD | AltD | AltD |
| Delete (kill) the previous word | OptionBackspace | AltBackspace | AltBackspace |
| Kill to the end of the line | CtrlK | CtrlK | CtrlK |
| Set the mark (start a selection) | CtrlSpace | CtrlSpace | CtrlSpace |
| Select the whole buffer | CtrlX,H | CtrlX,H | CtrlX,H |
| Cut (kill) the selection | CtrlW | CtrlW | CtrlW |
| Copy the selection | OptionW | AltW | AltW |
| Paste (yank) | CtrlY | CtrlY | CtrlY |
| Replace the paste with an older killRight after Ctrl+Y | OptionY | AltY | AltY |
| Open a new line after the cursor | CtrlO | CtrlO | CtrlO |
| Swap two characters | CtrlT | CtrlT | CtrlT |
| Swap two words | OptionT | AltT | AltT |
| Uppercase the word | OptionU | AltU | AltU |
| Lowercase the word | OptionL | AltL | AltL |
| Capitalize the word | OptionC | AltC | AltC |
| Comment or uncomment | Option; | Alt; | Alt; |
| Rewrap the paragraph | OptionQ | AltQ | AltQ |
| Expand the word from other text | Option/ | Alt/ | Alt/ |
Search and replace
4 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Search forward as you type | CtrlS | CtrlS | CtrlS |
| Search backward as you type | CtrlR | CtrlR | CtrlR |
| Search with a regular expression | CtrlOptionS | CtrlAltS | CtrlAltS |
| Find and replace, asking each time | OptionShift5 | AltShift5 | AltShift5 |
Windows
5 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Split the window top and bottom | CtrlX,2 | CtrlX,2 | CtrlX,2 |
| Split the window side by side | CtrlX,3 | CtrlX,3 | CtrlX,3 |
| Go to the other window | CtrlX,O | CtrlX,O | CtrlX,O |
| Close this window | CtrlX,0 | CtrlX,0 | CtrlX,0 |
| Close every other window | CtrlX,1 | CtrlX,1 | CtrlX,1 |
Macros and help
5 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Start recording a macro | F3orCtrlX,Shift9 | F3orCtrlX,Shift9 | F3orCtrlX,Shift9 |
| Stop recording, or run the macro | F4 | F4 | F4 |
| What does this key do? | CtrlH,K | CtrlH,K | CtrlH,K |
| Describe a function | CtrlH,F | CtrlH,F | CtrlH,F |
| Open the Emacs tutorial | CtrlH,T | CtrlH,T | CtrlH,T |
No shortcuts match. Try fewer words, the key names only, or search every app.
Show the key map: which keys Emacs uses mostDarker orange = used by more shortcuts
Open, save and switch files in Emacs
- Save as (write file)MacCtrlX,CtrlWWindowsCtrlX,CtrlWLinuxCtrlX,CtrlW
- Save all buffersMacCtrlX,SWindowsCtrlX,SLinuxCtrlX,S
- List all buffersMacCtrlX,CtrlBWindowsCtrlX,CtrlBLinuxCtrlX,CtrlB
- Close (kill) a bufferMacCtrlX,KWindowsCtrlX,KLinuxCtrlX,K
- Repeat or modify the next commandMacCtrlUWindowsCtrlULinuxCtrlU
Move around in Emacs: lines, words, end of file and go to line
- Forward one characterMacCtrlFWindowsCtrlFLinuxCtrlF
- Back one characterMacCtrlBWindowsCtrlBLinuxCtrlB
- Next lineMacCtrlNWindowsCtrlNLinuxCtrlN
- Previous lineMacCtrlPWindowsCtrlPLinuxCtrlP
- Forward one wordMacOptionFWindowsAltFLinuxAltF
- Back one wordMacOptionBWindowsAltBLinuxAltB
- Start of the lineMacCtrlAWindowsCtrlALinuxCtrlA
- End of the lineMacCtrlEWindowsCtrlELinuxCtrlE
- Start of the bufferMacOptionShift,WindowsAltShift,LinuxAltShift,
- End of the bufferMacOptionShift.WindowsAltShift.LinuxAltShift.
- Scroll down a screenMacCtrlVWindowsCtrlVLinuxCtrlV
- Scroll up a screenMacOptionVWindowsAltVLinuxAltV
- Recenter the screen on the cursorMacCtrlLWindowsCtrlLLinuxCtrlL
- Go to a line numberMacOptionG,GWindowsAltG,GLinuxAltG,G
- Forward one paragraphMacOptionShift]WindowsAltShift]LinuxAltShift]
- Back one paragraphMacOptionShift[WindowsAltShift[LinuxAltShift[
Select all, copy, paste and undo in Emacs
Emacs calls cutting killing and pasting yanking: C-w kills the region, M-w copies it, and C-y yanks it back.
- Delete the next characterMacCtrlDWindowsCtrlDLinuxCtrlD
- Delete (kill) the next wordMacOptionDWindowsAltDLinuxAltD
- Delete (kill) the previous wordMacOptionBackspaceWindowsAltBackspaceLinuxAltBackspace
- Select the whole bufferMacCtrlX,HWindowsCtrlX,HLinuxCtrlX,H
- Cut (kill) the selectionMacCtrlWWindowsCtrlWLinuxCtrlW
- Copy the selectionMacOptionWWindowsAltWLinuxAltW
- Replace the paste with an older killMacOptionYWindowsAltYLinuxAltY
- RedoMacCtrlShift/WindowsCtrlShift/LinuxCtrlShift/
- Open a new line after the cursorMacCtrlOWindowsCtrlOLinuxCtrlO
- Swap two charactersMacCtrlTWindowsCtrlTLinuxCtrlT
- Swap two wordsMacOptionTWindowsAltTLinuxAltT
- Uppercase the wordMacOptionUWindowsAltULinuxAltU
- Lowercase the wordMacOptionLWindowsAltLLinuxAltL
- Capitalize the wordMacOptionCWindowsAltCLinuxAltC
- Comment or uncommentMacOption;WindowsAlt;LinuxAlt;
- Rewrap the paragraphMacOptionQWindowsAltQLinuxAltQ
- Expand the word from other textMacOption/WindowsAlt/LinuxAlt/
- Accented letters
- C-x 8 followed by the accent and letter types it: C-x 8 ' e gives é, and C-x 8 Enter lets you search any character by name.
Search and replace in Emacs
- Search backward as you typeMacCtrlRWindowsCtrlRLinuxCtrlR
- Search with a regular expressionMacCtrlOptionSWindowsCtrlAltSLinuxCtrlAltS
- Find and replace, asking each timeMacOptionShift5WindowsAltShift5LinuxAltShift5
Split windows, macros and built-in help in Emacs
- Split the window top and bottomMacCtrlX,2WindowsCtrlX,2LinuxCtrlX,2
- Split the window side by sideMacCtrlX,3WindowsCtrlX,3LinuxCtrlX,3
- Close this windowMacCtrlX,0WindowsCtrlX,0LinuxCtrlX,0
- Close every other windowMacCtrlX,1WindowsCtrlX,1LinuxCtrlX,1
- Start recording a macroMacF3orCtrlX,Shift9WindowsF3orCtrlX,Shift9LinuxF3orCtrlX,Shift9
- Stop recording, or run the macroMacF4WindowsF4LinuxF4
- What does this key do?MacCtrlH,KWindowsCtrlH,KLinuxCtrlH,K
- Describe a functionMacCtrlH,FWindowsCtrlH,FLinuxCtrlH,F
- Open the Emacs tutorialMacCtrlH,TWindowsCtrlH,TLinuxCtrlH,T
Emacs keyboard shortcuts: questions
- What is the Meta key in Emacs?
- Meta is Alt on Windows and Linux and Option on a Mac. Pressing Esc and then the key also works on any keyboard.
- How do I quit Emacs?
- Press Ctrl+X then Ctrl+C. Emacs asks before closing if a buffer has unsaved changes.
- Do Doom Emacs and Spacemacs use these shortcuts?
- They keep most of them but put Vim keys (evil-mode) on top and gather commands under Space as a leader key, such as SPC f f to open a file. The C-x and C-h keys here still work.
These are the default key bindings in GNU Emacs 30.1, as published by GNU Project. Shortcuts that need an extension, an add-in or a changed keymap are left out. Where two combinations do the same thing, both are shown.
Single-system lists: Emacs keyboard shortcuts for Mac, Emacs keyboard shortcuts for Windows, Emacs keyboard shortcuts for Linux.
Each shortcut has its own page with the keys for every system, related shortcuts and the same action in other apps. The printable cheat sheet fits the whole list on one or two pages.