It feels like most environments for editing code have line numbers hidden by default. For example, Eclipse, IntelliJ, Oracle SQL Developer, and Vim all seem to have the default setting as not showing line numbers, and so developers must go into the settings and turn line numbers on if they would like to see them.

Displaying line numbers is essential when debugging code in an environment where errors are reported by telling the developer the number of the line the error occurred on. Line numbers also give the developer a quantifiable sense of how long his code is and, in the case of large files, a sense of where in the file he is. Not to mention, line numbers are absolutely essential when doing any sort of partner programming.

So why is the default behavior in so many text editors to have line numbers off? Is it because of the aesthetics, i.e. having a cleaner look without line numbers? It feels like it wouldn't be, as applications made by developers for developers seem to be the exact sort of scenario where function would be chosen over form.

  • 3
    I've wondered this as well. I don't know anyone who codes without line numbers, as bug reports tend to give line numbers.. – HC_ Jul 6 '15 at 16:46
  • 1
    Interestingly, line numbers are enabled by default in Notepad++. – thunderblaster Jul 6 '15 at 17:44
  • It's part of the gamification of software development driven by hypertrophic IDEs. The worst part is that some people can't even build Java without Eclipse, let alone develop – gd1 Jul 7 '15 at 7:53
  • I don't need each line to have a number, and I would prefer to have more space (and less distraction). I can check the status bar for line number and I can use ctrl+g for "Go-to line". – Anonsage Jul 9 '15 at 14:33

There are 4 types of application postures defined by Alan Cooper - Sovereign, Transient, Daemon, and Parasitic


A posture is nothing but the behavioral stance of the application. IDEs fall under sovereign applications that monopolizes the user's attention for long periods of time. Word processors, Image editors like Photoshop are a few examples of sovereign posture applications.

All these applications strive to maintain the flow state. To achieve this goal, one of the design patterns is to avoid distractions in the work area. Support elements like grids and guides are invisible by default, but there is always a shortcut key to toggle the visibility.

The same design pattern is followed for line numbers to keep the work area clean and focused when coding. If you notice, some of these apps make line numbers automatically visible in debug mode. Both patterns are for the same reason, to maintain the flow state, and providing information only when most people really need it.

I use Notepad++ and Sublime Text for HTML, CSS, Javascript, and Python. Both the editors have line numbers visible. Eclipse doesn't. But, when you switch to debug mode, it automatically provides line numbers.

It is true that it does not help in cases like partner programming. But, I am sure IDEs that are developed specific to partner programming (if there's any), would have line numbers visible by default.

| improve this answer | |

Main reason: smarter and modern IDEs

Line numbers are most of the times only needed when looking at stacktraces and errors etc. But the most modern IDEs have smart error tracing tools, and with a single mouse click the cursor will be placed on the line that generated the error. That's the main reason why line numbers are disabled by default, they are simply not needed anymore. Error solving can be done without line numbers these days.

Some thoughts:

I also found that in quit some cases IDEs are used on small (low res) screens like laptops. This is based on personal experience. But for example when watching the coding talks at the Google IO I often see presenters struggling with their screen space.

Another reason to disable them by default, is to discourage the use of line number based goto statements which are still available in some languages. But this is mainly something of the past, since the most commonly used languages these days don't support them.

I still like line numbers

But I'm one of those people who enables line numbers always. Why?

  • Stacktraces and debugging (breakpoints);
  • Code reviewing (pair programming etc.);
  • Quick compare of local code against Git code.

I noticed an intresting thing: Most Git clients and websites, and other online code repositories have line numbers enabled, not disabled. But that's probably due to the fact that these tools are used for code comparing and reviewing.

| improve this answer | |

It's true, line numbers are generally off by default. Visual Studio also has the same behaviour.

For general cases, line numbers are more often not wanted than they are wanted. Of course, that's not to say there aren't important situations where you want them on, including pair programming, stack trace examination, code referencing etc.

If they were on by default, there would simply be more people looking for the option to turn them off because they value the screen space more than the line numbers, or find the extra clutter distracting. The vendors will have done their research and determined the most common use case.

In my mind the fact that so many vendors have reached the same conclusion builds confidence that they have in fact all reached the right decision.

| improve this answer | |
  • 3
    I like your point, but I'm not so ready to agree that most people don't use line numbers -- I don't know anyone who codes without line numbers, nor do I know anyone who knows anyone who codes without line numbers. – vijrox Jul 6 '15 at 17:02
  • Yeah - I don't have data to back this up one way or the other either, so I'm hoping someone else can come up with something other than personal preference or anecdotal evidence. Data rules. – Roger Attrill Jul 6 '15 at 17:39
  • 2
  • @RogerAttrill Nice link! Jon Skeet making me question my line-number-enabling ways.. – HC_ Jul 6 '15 at 17:43

It might be because of design inertia.
Once upon a time monitors rendered 640x480 pixels, and the space taken by the line numbers was significant.
So you turned them on only when you really needed them.
The previous text editors, those operated via teletype terminals (connected typewriters) always printed the line numbers because it was the main way to addrss a code line.
Nobody (until Vijay) revised a design decision made in quite a different context.

Getting personal:
I use vim, that was developed in the seventies.
Originally it ran on terminals, that is, it rendered exactly 80 characters long lines. But, as many other editors do, it permanently tells me the number of the current line in a status area at the bottom.
Also, I can position in the line mentioned by the error message with a simple command 1234G to go to line 1234.
Also, the numbers column adds some visual noise whilst it's mostly ignored.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.