HTML Shortcut Keys: The Essential List

How-to basics · Updated November 23, 2026

HTML shortcut keys are keyboard combinations that speed up writing, editing, and formatting code in code editors and IDEs. The most essential ones include Ctrl+S to save, Ctrl+Z/Ctrl+Y to undo/redo, and Ctrl+D to select the next matching word (in VS Code). Below is a practical guide to the shortcuts that matter most, how they work, and how to customize them.

Why Shortcut Keys Matter for HTML

Writing HTML involves repetitive tags, closing brackets, and indentation. Keyboard shortcuts reduce mouse dependency, which speeds up coding and reduces strain. For example, typing div then pressing Tab in Emmet expands to <div></div> in most editors. Similarly, Ctrl+/ toggles a comment on the current line. These small wins add up over a long session.

Universal Shortcuts in Most Editors

Many shortcuts are shared across VS Code, Sublime Text, Atom, and Notepad++. These are the ones you’ll use daily:

  • Ctrl+S – Save file (Cmd+S on Mac)
  • Ctrl+Z – Undo (Cmd+Z on Mac)
  • Ctrl+Y or Ctrl+Shift+Z – Redo (Cmd+Shift+Z on Mac)
  • Ctrl+F – Find in file (Cmd+F on Mac)
  • Ctrl+H – Replace in file (Cmd+Option+F on Mac)
  • Ctrl+A – Select all (Cmd+A on Mac)
  • Ctrl+C / Ctrl+X / Ctrl+V – Copy, cut, paste (Cmd+C/X/V on Mac)

These work in virtually every text editor and even in browser developer tools.

VS Code-Specific HTML Shortcuts

VS Code is the most popular editor for web development, and it has several powerful shortcuts:

  • Ctrl+Shift+P – Open Command Palette (Cmd+Shift+P on Mac)
  • Ctrl+D – Select next occurrence of the current word (Cmd+D on Mac). Press repeatedly to select multiple occurrences, then type to change all.
  • Ctrl+Shift+L – Select all occurrences of the current word (Cmd+Shift+L on Mac)
  • Alt+Up/Down – Move line up or down (Option+Up/Down on Mac)
  • Shift+Alt+Down – Duplicate line down (Shift+Option+Down on Mac)
  • Ctrl+Shift+K – Delete line (Cmd+Shift+K on Mac)
  • Ctrl+] – Indent line (Cmd+] on Mac)
  • Ctrl+[ – Outdent line (Cmd+[ on Mac)

For HTML specifically, Ctrl+Space triggers IntelliSense suggestions, and Shift+Alt+F formats the document (Shift+Option+F on Mac).

Emmet Shortcuts for Rapid HTML

Emmet is a plugin built into VS Code and many other editors. It lets you write CSS-like abbreviations that expand to full HTML. For example:

  • Type ul>li*5 then press Tab to get a <ul> with five <li> items.
  • Type .container then Tab to get <div class="container"></div>.
  • Type #header then Tab to get <div id="header"></div>.
  • Type a[href="#"] then Tab to get <a href="#"></a>.

Emmet also supports wrapping: select a line, press Ctrl+Shift+P, type “Wrap with Abbreviation,” then enter div to wrap it.

Browser Developer Tools Shortcuts

When you’re testing HTML, the browser’s DevTools are essential. Common shortcuts:

  • F12 or Ctrl+Shift+I – Open DevTools (Cmd+Option+I on Mac)
  • Ctrl+Shift+C – Inspect element (Cmd+Shift+C on Mac)
  • Ctrl+Shift+J – Open Console tab (Cmd+Option+J on Mac)
  • Inside the Elements panel, press H to hide the selected element, Delete to remove it, and Ctrl+Z to undo the change.

These shortcuts help you debug layout and styling issues quickly without leaving the keyboard.

How to Customize Shortcuts

Most editors allow remapping. In VS Code, open File > Preferences > Keyboard Shortcuts (or Ctrl+K Ctrl+S). You can search for a command, click the pencil icon, and press a new key combination. For example, if you prefer Ctrl+E for Emmet expand, you can set that. On Mac, use Code > Preferences > Keyboard Shortcuts.

In Sublime Text, go to Preferences > Key Bindings and edit the JSON file. In Notepad++, use Settings > Shortcut Mapper.

Common Problems and Misconceptions

“Shortcuts don’t work in my editor.” Often it’s because the editor is in a different mode (e.g., Vim mode) or a plugin has overridden the key. Check your keyboard shortcuts list and ensure no extension conflicts.

“Emmet isn’t expanding.” Make sure the file is saved with an HTML extension (like .html) and that Emmet is enabled. In VS Code, check the status bar for “Emmet” and ensure the language mode is HTML.

“Ctrl+D selects the wrong text.” In VS Code, Ctrl+D selects the next occurrence of the current selection. If you have multiple cursors, pressing Ctrl+U undoes the last selection.

Alternatives to Memorizing Shortcuts

If memorizing shortcuts feels overwhelming, you can use the Command Palette (Ctrl+Shift+P) to type any command by name. For example, type “format document” to run the formatter. Also, many editors have a “shortcut cheatsheet” built in—in VS Code, open the Command Palette and type “Keyboard Shortcuts Reference” to see a printable PDF.

Another alternative is to use a snippet manager like “HTML Snippets” extensions, which provide autocomplete for common tags without needing to remember abbreviations.

Frequently Asked Questions

How do I comment out multiple lines of HTML? Select the lines and press Ctrl+/ (or Cmd+/ on Mac) in VS Code, Sublime, and most editors. This wraps the selection in <!-- -->.

What is the shortcut for auto-formatting HTML? In VS Code, Shift+Alt+F (Windows/Linux) or Shift+Option+F (Mac). In Sublime Text, it’s Ctrl+Shift+P then “HTML/CSS/JS Prettify.”

How do I duplicate a line in HTML? In VS Code, Shift+Alt+Down (Windows/Linux) or Shift+Option+Down (Mac). In Sublime, Ctrl+Shift+D (Windows/Linux) or Cmd+Shift+D (Mac).

Can I use shortcuts in online editors like CodePen? Yes, but they vary. CodePen uses its own keymap—press ? on the editor to see available shortcuts. Most browser-based editors support basic ones like Ctrl+S to save (though it may open the save dialog) and Ctrl+Z.

Why isn’t my Emmet shortcut working? Ensure the file is HTML and that Emmet is installed/enabled. In VS Code, you can check by typing ! and pressing Tab—if it doesn’t expand to a boilerplate, go to File > Preferences > Settings and search for “emmet.includeLanguages” to add “html”.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.