Display line numbers in the editor

You can show or hide line numbers in your code. Here's how.

  1. On the menu bar, select Tools > Options > Text Editor, and then select either the language you're using or All Languages to turn on line numbers in all supported programming languages.

    Tip

    You can also type line number in the Search box, and then choose Turn line numbers on or off from the results.

  2. Select the Line numbers checkbox to show line numbers, or clear the checkbox to hide line numbers.

    Screenshot of the Options dialog you can use to show or hide line numbers in the Visual Studio editor.

Note

Line numbers aren't added to your code; they're just for reference.