Display line numbers in the editor

This article describes how to show or hide line numbers in your code.

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

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

    Screenshot of using the Search box to search for line numbers.

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

    Screenshot of the Options dialog that 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.