shortcutsguide

Move Line Shortcut (⌥↑↓ / Alt+↑↓)

Reorder code without cut-and-paste: press Alt+↑ / Alt+↓ on Windows or ⌥↑ / ⌥↓ on Mac in VS Code to move the current line.

ActionMacWindows
Move line up (VS Code) ⌥↑ Alt+↑
Move line down (VS Code) ⌥↓ Alt+↓
Move line (Sublime Text) ⌘⌃↑ / ⌘⌃↓ Ctrl+Shift+↑ / ↓
Move line (JetBrains) ⇧⌥↑ / ⇧⌥↓ Shift+Alt+↑ / ↓
Move selection too select lines, then ⌥↑/↓ select lines, then Alt+↑/↓

Move a line up or down

In VS Code, press Alt+↑ / Alt+↓ (Windows/Linux) or ⌥↑ / ⌥↓ (Mac) to swap the current line with the one above or below. Select several lines first to move the whole block. This is faster and safer than cut-and-paste because it never touches the clipboard.

Other editors

Sublime Text: Ctrl+Shift+↑/↓ (Win) / ⌘⌃↑/↓ (Mac). JetBrains IDEs: Shift+Alt+↑/↓ / ⇧⌥↑/↓ moves a line, while Shift+Ctrl+↑/↓ moves a whole statement.

Troubleshooting

On Mac, ⌥↓ can be swallowed by Mission Control or a window manager (Rectangle, Magnet). Quit the conflicting app or rebind Move Line Down in VS Code. On Windows, nothing clashes with Alt+arrow by default except the Intel screen-rotation hotkeys.

FAQ

How do I move a line up or down in VS Code?

Alt+↑ / Alt+↓ on Windows/Linux, ⌥↑ / ⌥↓ on Mac. Select multiple lines to move the whole block.

Does move line work on a selection?

Yes. Select one or more lines first, then press the move shortcut — the entire selection moves together.

What is move line in JetBrains IDEs?

Shift+Alt+↑/↓ (Windows) or ⇧⌥↑/↓ (Mac) moves a line; Shift+Ctrl+↑/↓ moves a whole statement.

Why doesn't ⌥↓ work on my Mac?

A window manager like Rectangle or Magnet, or Mission Control, may use the same combination. Disable it or rebind 'Move Line Down' in VS Code's keyboard shortcuts.