Buffer Yard
Getting started

Essential Emacs Keybindings: A Cheat Sheet for Beginners

Updated

Illustration of a dark keyboard with blank keys, two modifier keys highlighted and wired to a third key

You open a file, make one edit, and then sit there wondering how to save it. Every new Emacs user hits that moment, and it is the reason this Emacs keybindings cheat sheet exists. It covers the keys you will actually use in the first weeks, grouped by task, with tables you can keep open in a second window. It is not the full list (Emacs has thousands of bindings), just the essential Emacs keybindings that make the editor usable, plus the help keys that let you find the rest yourself.

How Emacs keybindings are written

Emacs documentation writes keys in a compact notation, and once you can read it every manual and package README opens up.

  • C-x means hold Control and press x.
  • M-x means hold Meta and press x. On a PC keyboard Meta is Alt; on a Mac it is usually Option, or Command if you have remapped it.
  • C-M-s means hold Control and Meta together, then press s.
  • C-x C-f is a sequence: press C-x, let go, then press C-f.
  • RET is Enter, SPC is the space bar, TAB is Tab, DEL is Backspace.

If your terminal or window manager swallows Alt, press and release Escape, then the key. ESC x works exactly like M-x. Sequences that start with C-x are mostly global commands built into Emacs. Sequences that start with C-c are shared between you and the active major and minor modes, under rules that matter later when you add your own.

The essential cheat sheet: files and buffers

A buffer is the text Emacs holds in memory; a file is what sits on disk. Most of the time a buffer shows one file, but buffers also hold shells, help pages and compilation output. These are the essential Emacs keybindings for files and buffers, the ones you will press most:

Keys Command What it does
C-x C-f find-file Open a file, or create it if it does not exist
C-x C-s save-buffer Save the current buffer
C-x C-w write-file Save under a new name
C-x s save-some-buffers Save all modified buffers, asking for each
C-x b switch-to-buffer Switch to another buffer by name
C-x C-b list-buffers Show every open buffer
C-x k kill-buffer Close a buffer
C-x C-c save-buffers-kill-terminal Quit Emacs, offering to save

Of these, C-x b is the one that changes how you work. Instead of tabs, you jump to any buffer by typing part of its name. With a good completion setup it becomes the fastest way to move around a project, which is why setting up completion is usually the second thing worth doing after learning these keys. Replacing list-buffers with ibuffer is a common early tweak too, since it groups and filters buffers in a far more useful way.

Windows: splitting the frame

Emacs vocabulary is older than the desktop. What your operating system calls a window, Emacs calls a frame; the panes inside a frame are windows.

Keys Command What it does
C-x 2 split-window-below Split into top and bottom
C-x 3 split-window-right Split into left and right
C-x o other-window Move to the next window
C-x 1 delete-other-windows Keep only the current window
C-x 0 delete-window Close the current window

Closing a window never closes the buffer in it, so nothing is lost. If you use C-x o a lot, windmove-default-keybindings lets you move between windows with Shift and the arrow keys, which is easier on a layout with three or four panes.

One more built-in is worth switching on early. Help buffers, compilation output and completion lists all open new windows and rearrange the ones you had, and it is easy to lose a carefully arranged split that way. winner-mode records every window layout, and C-c left steps back to the previous one, with C-c right to step forward again. Those arrow keys sit outside the C-c plus letter range reserved for you, so they never clash with your own bindings. It costs one line in your init file and turns a messy screen from an annoyance into a single keypress. Pair it with C-x 1 whenever you simply want one window back and do not care about the old layout.

Moving around without the arrow keys

The arrow keys work, and nobody will take them away. The control-key movement commands are worth learning anyway, because your hands stay on the home row and the same keys work in the minibuffer, in shells and in most packages.

Keys Moves to
C-f / C-b Next / previous character
M-f / M-b Next / previous word
C-n / C-p Next / previous line
C-a / C-e Start / end of line
M-< / M-> Start / end of buffer
C-v / M-v Page down / page up
C-l Recenter the screen around the cursor
M-g g Go to a line number

The pattern is the useful part: C- acts on small units, M- on larger ones. C-f moves a character, M-f a word; C-a goes to the line start, M-a to the sentence start. Once that clicks, you can guess bindings before looking them up.

Search and replace

Incremental search is one of the best things in Emacs, and it doubles as a way to move. Press C-s, start typing, and the cursor jumps to the first match as you type. Press C-s again for the next match, C-r to go backwards, RET to stop where you are, or C-g to return to where you started.

Keys Command What it does
C-s isearch-forward Search forward as you type
C-r isearch-backward Search backward as you type
C-M-s isearch-forward-regexp Regular-expression search
M-% query-replace Replace, confirming each match
C-M-% query-replace-regexp Same, with a regular expression

In query-replace, y replaces one match, n skips it, and ! replaces all remaining matches without asking.

The mark, the region, cut and paste

Emacs selects text with the mark. Press C-SPC to set it, move the cursor, and the text between the mark and the cursor is the region. Then act on it.

Keys Command What it does
C-SPC set-mark-command Set the mark and start a region
C-x h mark-whole-buffer Select the whole buffer
C-w kill-region Cut
M-w kill-ring-save Copy
C-y yank Paste
M-y yank-pop Cycle through earlier cuts after pasting
C-k kill-line Cut to the end of the line

Emacs names are old here as well: cutting is killing, pasting is yanking. Everything you kill goes onto the kill ring, a history of cuts, so text from five cuts ago is still reachable with C-y followed by M-y.

Undo and redo

C-/ undoes. So do C-_ and C-x u, which are older spellings of the same command. Emacs undo is unusual: undoing is itself recorded as a change, so after an undo, any other command followed by more undoing walks back through the undos as well. Nothing is ever lost, though it takes getting used to.

If you want a plain redo, Emacs 28 added undo-redo, bound to C-? in graphical Emacs and C-M-_ everywhere. The vundo package from GNU ELPA draws the undo history as a tree, which is the clearest way to see what the undo system is doing.

Help keys every beginner should learn first

Every binding on this page can be looked up from inside Emacs. If you only memorise one group from this Emacs keybindings cheat sheet, make it this one, because it is the group that teaches you all the others.

Keys Command What it does
C-h k describe-key What does this key do?
C-h f describe-function Documentation for a function or command
C-h v describe-variable Current value and documentation of a variable
C-h m describe-mode Keys and features of the active modes
C-h b describe-bindings Every binding active in this buffer
C-h t help-with-tutorial The built-in interactive tutorial

The tutorial takes about half an hour and is still the best introduction for beginners. The help buffers link straight to the Emacs Lisp source of each command, which is how most people learn to read Elisp without ever deciding to.

M-x and C-g: the two keys that save you

M-x runs any command by name. Forgot a binding? Type M-x, then part of the command name, and complete it with Tab. If the command has a key, Emacs tells you in the echo area afterwards, so M-x slowly teaches you the shortcuts too.

C-g is the escape hatch. It cancels a half-typed key sequence, a minibuffer prompt or a running command. Whenever Emacs seems to be waiting for something you did not intend, press C-g, and press it again if the first one did not do it. Escape pressed three times (ESC ESC ESC) is the heavier version: it also closes extra windows and leaves recursive edits.

which-key for beginners who forget prefixes

When you press C-x and pause, which-key pops up a list of every key that can follow, with the command each one runs. It has been part of Emacs since 30.1, so on a current build all you need is:

(which-key-mode 1)

On Emacs 29 or older, install it from GNU ELPA first (see installing packages with use-package). For beginners it is the most useful single line in an init file, and plenty of experienced users keep it on because it makes rarely used prefixes like C-x r (registers and rectangles) discoverable.

Rebinding keys in your init file

Sooner or later a default binding will annoy you, or a command you use daily will have none. Emacs 29 added keymap-global-set and keymap-set, which take the key as a string in the same notation used throughout this page and check that it is valid:

;; Emacs 29 and later
(keymap-global-set "C-c d" #'duplicate-line)
(keymap-global-set "C-x C-b" #'ibuffer)
(keymap-set emacs-lisp-mode-map "C-c C-r" #'eval-region)

On older versions, or in configs written before 29, you will see global-set-key with kbd:

(global-set-key (kbd "C-x C-b") #'ibuffer)

Both do the same job. Put your personal commands under C-c plus a letter: the Emacs key binding conventions reserve that space for users, so packages and major modes stay out of it. Before overwriting a built-in binding, check it with C-h k; some of them are more useful than they look.

A word on CUA mode

If years of Ctrl+C and Ctrl+V are in your fingers, cua-mode maps copy, cut, paste and undo to C-c, C-x, C-v and C-z. It is cleverer than it sounds: those keys only act as copy and cut while a region is active, so the C-c and C-x prefixes still work the rest of the time.

It is a reasonable bridge for a week or two. Long term, the native keys are the better bet. Every manual, package README and answer you find online assumes them, and C-v as page-down is used in many places CUA mode does not reach. Learn the essential Emacs keybindings from this page first, and turn CUA on only if they still feel wrong after a month.

The Emacs keybindings cheat sheet above will carry most beginners through the first weeks. If Emacs is not on your machine yet, install a current Emacs first; once it is, pick a theme you can read for hours and start on the starter configuration.

Questions readers ask

What do C- and M- mean in Emacs keybindings?

C- means hold Control, M- means hold Meta, which is Alt on most keyboards. If Alt does not work, press and release Escape before the key instead.

How do I get out of a command I started by accident?

Press C-g. It cancels the current command, a half-typed key sequence or a minibuffer prompt. If one press is not enough, press it again.

Can I use Ctrl+C and Ctrl+V for copy and paste in Emacs?

Yes, turn on cua-mode with M-x cua-mode or in your init file. It only takes over those keys while text is selected, so the C-c and C-x prefixes keep working the rest of the time.

Which prefix should I use for my own keybindings?

Use C-c followed by a plain letter. The Emacs conventions reserve those sequences for users, so no well-behaved package or major mode will claim them.

How do I find out what a key does in Emacs?

Press C-h k and then the key. Emacs opens a help buffer with the command name, its documentation and a link to its source code.