Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Swap BracketsNew to Visual Studio Code? Get it now.
Swap Brackets

Swap Brackets

Jacob McCormack

|
1 install
| (0) | Free
An extension to swap brackets that wrap code from round brackets '(' to curly '{' and back
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Swap Brackets

Quickly swap the bracket type wrapping a block of code — toggle between ( ) and { } with a single command.

Usage

  1. Place your cursor on an opening bracket — either ( or {
  2. Run Swap Brackets from the Command Palette (Cmd+Shift+P → Swap Brackets)
  3. The bracket pair and all content inside will be swapped to the other bracket type

Keybindings / Hotkeys

  • Alt + Cmd + B on MacOS
  • Alt + Ctrl + B on Windows

Example

// Cursor on `(`
foo(a, b, c)
// → becomes
foo{a, b, c}

// Cursor on `{`
foo{a, b, c}
// → becomes
foo(a, b, c)

Notes

  • If the cursor is not on a ( or {, a warning message will appear
  • The cursor is returned to the opening bracket position after the swap
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft