How can I permanently enable line numbers in IntelliJ IDEA?
-
633why don't all IDE's have the default to "yes show line numbers", how do you debug anythign without using line numbers ? – NimChimpsky Sep 10 '12 at 08:43
-
10Most IDE's have the line number where your mouse cursor is in the status bar, but that's not too useful. Normally there is line numbers in stack traces right? In VIM you can jump to line numbers
G, and Sublime Text, Ctrl+g (type in line number). What's the benifit of line numbers if you can jump straight where you want to go? – Dauh Fhauc Sep 13 '13 at 13:43 -
23What I like the most about the line number column is that it provides an easy hit area for selecting multiple lines without having to fiddle with exact cursor placement. – Eric Cosky Dec 31 '14 at 17:32
-
2@NimChimpsky Well error messages (and the stack trace) in IntelliJ are links to the line of the code the error occurs on, so it's not too bad. – Anubian Noob May 05 '15 at 00:27
-
7I also can't imagine people working without line numbers switched on. And never the less you might possibly don't need it because you just click on links in stacktraces. It gives you orientation in the code and might also be usefull if you talk to someone else about fragments of it. – ccDict Oct 29 '15 at 08:45
-
9All of you talking about clicking on stack traces are assuming that the stack trace being debugged is generated in the IDE. This is almost never the case in a real world scenario. You get a stack trace from a client and then you need to track it down. – Dan Feb 03 '16 at 15:06
-
2@nullpointer: There never will. Looks like the user who asked the question has been deleted. – Sebastian Aug 01 '16 at 07:51
-
@Dan IntelliJ these days allows for analyzing an external stacktrace which makes lines into known code clickable. – Thorbjørn Ravn Andersen Oct 30 '22 at 18:17
21 Answers
IntelliJ 14.X Onwards
From version 14.0 onwards, the path to the setting dialog is slightly different, a General submenu has been added between Editor and Appearance as shown below
IntelliJ 8.1.2 - 13.X
From IntelliJ 8.1.2 onwards, this option is in File | Settings1. Within the IDE Settings section of that dialog, you'll find it under Editor | Appearance.
- On a Mac, these are named IntelliJ IDEA | Preferences...

- 185,044
- 174
- 569
- 824
-
98Cntrl + Shift + a --- Then type in "show line numbers". I use cntrl+shift+a for finding most menu stuff. – Uncle Iroh Dec 27 '12 at 17:39
-
10For the Mac new-schoolers, Android Studio > Preferences > Editor > Appearance > Show line numbers – whyoz May 21 '13 at 17:29
-
File | Settings | Editor | Appearance is where to find it in Android Studio, too (for obvious reasons?). – DSlomer64 Jul 02 '14 at 17:17
-
-
And if you don't like the Line Number color (used to be angry red) you can change that under Color & Fonts : General : Line Number – osundblad Dec 03 '14 at 23:05
-
Even faster: press SHIFT-SHIFT; type 'line number'; the option shows in the menu and press ENTER to enable/disable; Et voila ;) – Samuel Kerrien Sep 18 '15 at 10:01
-
It's still there (see IntelliJ 14.X) in IntelliJ IDEA 15 EAP. – ROMANIA_engineer Sep 26 '15 at 15:42
-
1
-
1NOT there in IntelliJ 2016.x :( The Shift-Shift workaround still works though. – csvan Apr 19 '16 at 15:23
-
3
-
CTRL+SHIFT+A on windows only activates it in the current editor for the current session. SHIFT+SHIFT(as in the comment earlier and another answer) is permanent. – Zoe Nov 26 '16 at 14:40
-
1An important note: if you want to permanently enable line numbers for all future projects, you should make sure you're editing the `Default Settings`. You can access these from the `File` menu just below `Settings`, or when all projects are closed. – JJ Brown Jun 09 '18 at 00:00
The question is obviously well answered already, but since IJ 13 you can enable line numbers in 2 seconds flat:
- Press shift twice
- Type "line number"
- The option shows in the menu and press enter to enable/disable.
Et voila ;)

- 2,573
- 28
- 22

- 6,965
- 2
- 29
- 32
-
5As @user3218743 said, turning line numbers on this way is TEMPORARY. This is not the optimal solution. – Shadoninja Mar 09 '16 at 20:24
-
-
if you start IJ and have line numbers disabled, run the instruction to enable it, then restart IJ, then the line numbers are disabled again ... – Samuel Kerrien Apr 27 '16 at 09:11
-
5@user3218743 and @SamuelKerrien It depends on which of the one of the `show line number`s you select. There is one which turns it on/off temporary and one which changes settings (with an on/off toggle at end of line) – osundblad Apr 28 '16 at 07:11
-
-
4@manuna: just for clarity, you have to press *and release* `Shift` **two times consequently**, something like a "double click". Not hold the both `Shift`s at the same time :) – Honza Zidek Mar 15 '17 at 09:56
-
2
-
7Shift then Shift should surely be written Shift, Shift not Shift+Shift. – charles-allen Aug 02 '17 at 14:27
-
This worked for me to enable line numbers in active view editor configurations which by default is disabled for large files – Sathish Nov 26 '20 at 13:42
NOT a solution, rather a TEMPORARY solution which only works only for the current editor and current session:
Simply right click on the place where the line-numbers should be, and there you'll see a small menu.
then, mark the "Show Line Numbers" option.
Please note that this only works on a per-file basis, however. Enjoy.

- 4,640
- 3
- 46
- 68
-
9This is the most temporary way of turning line numbers on. The top answer is the proper way to do this so it sticks. – Shadoninja Mar 09 '16 at 20:24
-
1Only the current editor and current session. Removed on restarting android studio and does not show in any other windows. – Zoe Nov 26 '16 at 14:40
-
1This does **not** answer the question! *How can I **permanently** enable line numbers in IntelliJ IDEA?* – Honza Zidek Sep 11 '18 at 08:30
-
If you are aware that your post does not answer the question, I think it should have been posted as a comment only, not as an answer. – Honza Zidek Sep 11 '18 at 23:23
In Intellij 13 the layout has changed, the Settings button can only be found in File -> Settings and not in the toolbars, and from there you follow the same steps: Editor -> Appearance -> Show line numbers, or search for Line numbers in the Settings search input.

- 1,594
- 1
- 15
- 21
-
6In Intellij 14 it's now File -> Settings -> Editor -> General -> Appearance -> Show line numbers. Or Search for "Line Numbers". – Radu Bompa Jan 29 '15 at 10:08
Android Studio 1.3.2 and on, IntelliJ 15 and on
Global configuration
File -> Settings -> Editor -> General -> Appearance -> Show line numbers
Current editor configuration
First way: View -> Active Editor -> Show Line Numbers (this option will only be available if you previously have clicked into a file of the active editor)
Second way: Right click on the small area between the project's structure and the active editor (that is, the one that you can set breakpoints) -> Show Line Numbers.

- 2,820
- 1
- 24
- 36
For InteliJ IDEA 11.0 and above
Goto File --> Settings in the Settings window Editor --> Appearance
and tick Show line numbers check box.

- 2,114
- 1
- 27
- 36
-
6This exact answer has [already been posted](http://stackoverflow.com/a/912112/447356) two and half years ago by Don. – Shadow The GPT Wizard Dec 28 '11 at 10:12
-
6I looked again in the posts. They are the same, the slight difference does not justify new answer you could add comment on the existing answer saying something like "it also exist in version 11" and maybe explain this slight difference. – Shadow The GPT Wizard Jul 20 '12 at 11:27
IntelliJ 14 (Ubuntu):
See: how-do-i-turn-on-line-numbers-permanently-in-intellij-14
Permanently:
File > Settings > Editor > General > Appearance > show line numbers
For current Editor:
View > Active Editor > Show Line Numbers
IntelliJ IDEA 15
5 approaches
Global change
File > Settings... > Editor > General > Appearance > Show line numbers
Hit Shift twice > write "line numbers" > Show Line Numbers (that one that has the toggle) > change the toggle to ON
Change for the Active Editor

- 54,432
- 29
- 203
- 199
-
Casper LI mentioned that **Android Studio 1.5.1** is similar with IntelliJ IDEA 15 regarding the line numbers. – ROMANIA_engineer Feb 03 '16 at 10:56
Ok in intelliJ 14 Ultimate using the Mac version this is it.
IntelliJ Idea > Preferences > Editor > General > Appearance > Show Line Numbers

- 12,285
- 11
- 52
- 61
-
4For those who have been struggling on Mac like I was to find this, don't be tricked by the "Appearance & Behavior" Tab, Like @Shawn said, it is under the editor tab, there are multiple levels with name appearance. Also Make sure you are looking at the settings under preferences. – Unome Mar 10 '15 at 17:00
-
On IntelliJ 12 on MAC OSX, I had a hard time finding it. The search wouldn't show me the way for some reason. Go to Preferences and under IDE Settings, Editor, Appearance and select 'Show line numbers'

- 4,296
- 6
- 44
- 65
Android Studio
Go to Android Studio => Preferences => Editor => General => Appearance => set Checked "Show line numbers"

- 424
- 4
- 17
I just hit this with IdeaVim plugin installed, where even if I set Show Line Numbers
, it continued to revert to hiding them.
The (forehead-slapping-worthy) solution was:
:set nu

- 13,559
- 7
- 62
- 90
I add this response for IntelliJ IDEA 2018.2 - Ultimate.
Using menu
IntelliJ Idea > Preferences > Editor > General > Appearance > Show Line Numbers
Using Shortcuts - First way
For Windows : Ctrl+Shift+a
For Mac : Cmd+shift+a
Using Shortcuts - Seconde way
Touch Shift twice
These three methods exist since the last 4 versions of Intellij and I think they remain valid for a long time.

- 4,765
- 8
- 40
- 57
1st way: Go to View => Active Editor => show line numbers
2nd way Go to Android Studio => Preferences => Editor=> Appearance => set Checked "Show Line Numbers"

- 3,401
- 4
- 33
- 60
On Mac Intellij 12.1.2 there is no File-Settings:
There is an application-name menu item to the left of "File" with a "preferences" menu item:
and within that is the "Settings" dialog shown by the Windows Intellij.

- 1,879
- 1
- 13
- 9
In IntelliJ 14 it has moved again somewhat down the menu.
Now we have it unter Editor -> General -> Appearance

- 625
- 7
- 13
On IntelliJ IDEA 2016.1.2
Go to Settings > Editor > General > Appearance then check the Show Line number option

- 8,740
- 6
- 40
- 61
-
Is 'Settings' in IDEA 2016.1.2 called 'preferences'? I'm new to IntelliJ, so I don't want to edit that in this Answer before asking... – cellepo Jun 08 '16 at 23:34
-
1
IntelliJ 2019 community edition has line number by default. If you want to show or hide line numbers, go to the following settings to change the appearance.
go to → File → Setting → Editor → General → Appearance → [Check] Show line numbers

- 56,955
- 33
- 144
- 158

- 754
- 8
- 17
For IntelliJ 20.1 or above, on Mac OSX:
IntelliJ IDEA -> Editor -> General -> Appearance -> Show line numbers
Point to be noted: Always look for Editor
For shortcut:
⌘ + ⇧ + A (command + shift + A)
and click on the pop up to turn on Show line numbers
and you are good to go.

- 872
- 13
- 14