shortcutsguide

Comment Shortcut (⌘/ / Ctrl+/)

Comment or uncomment a line of code: ⌘/ on Mac, Ctrl+/ on Windows — in VS Code and most editors.

ActionMacWindows
Toggle line comment ⌘/ Ctrl+/
Toggle block comment ⌥⇧A Shift+Alt+A
Comment multiple lines Select + ⌘/ Select + Ctrl+/

Comment out a line

In VS Code, Sublime Text, JetBrains IDEs and most editors press ⌘+/ on the Mac or Ctrl+/ on Windows to toggle a line comment. Select several lines first and the same shortcut comments or uncomments them all.

Block comments

For a block comment (/* ... */) use ⇧⌥A on the Mac or Shift+Alt+A on Windows in VS Code. JetBrains IDEs use ⌘⇧/ / Ctrl+Shift+/ for block comments.

FAQ

What is the comment shortcut in VS Code?

Press ⌘/ on Mac or Ctrl+/ on Windows to toggle a line comment on the current line or selection.

How do I comment multiple lines at once?

Select the lines, then press ⌘/ (Mac) or Ctrl+/ (Windows) to comment or uncomment them together.

What's the block comment shortcut?

In VS Code use ⇧⌥A (Mac) or Shift+Alt+A (Windows); JetBrains IDEs use ⌘⇧/ / Ctrl+Shift+/.