Is there is any definitive research that attempts to answer what character counts make the most human readable line lengths for programming code (typically mono-spaced font, high liklihood of small font size) when considering, in particular, the fact that code bases are very often shared amongst many people; and also the unusual way it looks when compared to other forms of text based communication, such as prose or poetry.

  • if the code is clean (books.google.de/books/about/…) and best practices are followed, it is legible. If it's clean the line length will be short anyway, so I really doubt there're any studies about this topic. Btw: The "default" 80 chars per line is a relic from when monitors didn't have more horizontal space.
    – Lovis
    Nov 20, 2013 at 10:10
  • There will never be any definitive answer. In programming code line length is very much a matter of preference and usually "regulated" by coding standards. Coding standards differ per organisation (sometimes even per team). Legibility can, but is not required to, factor into the chosen maximum line length of the standard. Nov 20, 2013 at 10:13
  • @MarjanVenema - Respectfully disagree. Ability to scan long lines degrades as the line grows longer, so there must exist an optimum (not the same for everybody, but that's immaterial). Nov 20, 2013 at 12:52
  • 1
    @DeerHunter: Yes, and personal preference would be based on personal optimum, don't you think? Point is, most coding standards choose an arbitrary line length, often 80 or 120, based on the IDE used, or monkey-stair-banana habits, not on any legibility criteria as such. Nov 20, 2013 at 13:21
  • 1
    This research suggests readability is determined by more than line length and type size. I'm assuming this questions is using 'legibility' as a synonym for 'readability'. Nov 20, 2013 at 13:55

1 Answer 1


While there's no definitive answer, reading code is still reading just like any other text and some guidelines indicate that 50-75 characters per line is a good number for English.

The cognitive load of code is often far higher per line than it is in English so you probably want to err on the shorter side. I haven't seen any research on the specific column number after which we start to lose focus when reading code, but I imagine it varies significantly based on programming language.

This would be a very interesting research topic.

  • 2
    The semantic "density" of a line of code is nowhere near the semantic complexity of a line of English. A better phrase might be the "cognitive load"? Nov 20, 2013 at 22:50
  • A single word, especially in higher order programming languages, can imply any completely arbitrary amount of meaning.
    – Jeffy
    Nov 21, 2013 at 1:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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