How to change uppercase and lowercase in Visual Studio Code

Select text in Visual Studio Code and run Transform to Uppercase or Transform to Lowercase from the Command Palette. The editor can apply the command to several selections at once.

Change case from the Command Palette

  1. In an editable file, select the text to change. To convert the whole file, select all with Ctrl+A on Windows or Linux or ⌘+A on macOS.
  2. Open the palette with Ctrl+Shift+P on Windows or Linux or ⌘+Shift+P on macOS.
  3. Search for transform or the localized action name. Choose the uppercase or lowercase command, press Enter, and check the selected text.

Microsoft’s Command Palette guidance

Compare the three case commands

Command Input and result
Transform to Uppercase Draft_Name → DRAFT_NAME
Transform to Lowercase Draft_Name → draft_name
Transform to Title Case DRAFT name → Draft Name

Transform to Title Case capitalizes word starts in the example. Review acronyms and style-guide exceptions after applying it.

Transform several selections at once

Paste the following lines into a scratch editor. Change the first two lines and leave the last line alone.

draft_name
Draft_Name
keep = MixedCase
  1. Select both of the first two lines. For nonadjacent text, enable separate selections with the multi-cursor controls and check both ranges before running the command.
  2. Run the uppercase command. The first two lines become DRAFT_NAME. The last line keeps MixedCase.
  3. When the same spelling occurs repeatedly, select one match and add the next with Ctrl+D on Windows or Linux or ⌘+D on macOS. Review the selected ranges before changing them.

Microsoft’s multiple-selection guidance

Recover the original case or find a missing command

Use Undo with Ctrl+Z on Windows or Linux or ⌘+Z on macOS to recover mixed capitalization. Applying the opposite transformation loses the original mix.

Without a selection, the command can act on the word at the cursor. Select explicitly for precise results. If the command is missing, focus an editable file. For frequent use, search for the command in Keyboard Shortcuts and assign a binding.

Customize VS Code keyboard shortcuts