How to Jump to a Specific Line in VS Code

Navigating through large code files in Visual Studio Code (VS Code) can be time-consuming if you rely solely on scrolling. Fortunately, VS Code provides several built-in shortcuts and methods to instantly jump to any specific line number. This guide covers the fastest ways to navigate directly to a line using keyboard shortcuts, the Command Palette, and the status bar.

Method 1: The Go to Line Keyboard Shortcut (Fastest)

The quickest way to jump to a specific line in VS Code is by using the dedicated “Go to Line” keyboard shortcut.

  1. Press Ctrl + G on Windows/Linux, or Ctrl + G on macOS.
  2. A small input box will appear at the top of the window with a colon (:) already typed.
  3. Type the line number you want to reach.
  4. Press Enter to instantly move your cursor to that line.

Method 2: Using the Quick Open Menu

If you are already using the Quick Open menu to search for files, you can transition directly into jumping to a line.

  1. Open the Quick Open menu by pressing Ctrl + P on Windows/Linux or Cmd + P on macOS.
  2. Type a colon (:) followed immediately by the line number (for example, :42).
  3. Press Enter to jump to that line.

Note: You can also use this to open a specific file and jump to a line simultaneously by typing the filename, a colon, and the line number (e.g., app.js:42).

Method 3: Using the Status Bar

If you prefer using your mouse, you can trigger the search input directly from the editor’s status bar.

  1. Look at the bottom-right corner of your VS Code window.
  2. Click on the section that displays the current line and column numbers (it usually looks like Ln X, Col Y).
  3. The “Go to Line” input box will open at the top of your screen.
  4. Type your target line number and press Enter.