Why is 80 characters the "standard" limit for code width? Why 80 and not 79, 81 or 100? What is the origin of this particular value?

  • 20
    – Sotiris
    Commented May 15, 2012 at 10:45
  • 18
    Before anyone thinks of adding another answer to this question please read the accepted answer and Mark Booth's answer. These answer the question comprehensively. The punchcard came first.
    – ChrisF
    Commented May 15, 2012 at 20:54
  • 3
    Is it still the standard? Can't we get over it yet? I'd say 140 is more than acceptable with current displays (even smartphones). I chose 140 because it's the limit in Twitter, but 160 (doubling the previous) would fit as well...
    – Trylks
    Commented Oct 13, 2014 at 17:07
  • The standard is actually 79, if you're super-careful. Lines that are 80 characters long may cause wrapping when the file is dumped to an 80 column terminal unless the terminal is set to truncate long lines. In some terminals, under some configuration, when a character is printed in the 80th position, the cursor then advances to the start of the next line. When the carriage return/line-feed is issued, then a blank line results. I think most ANSI implementations do (are required?) to implement a shadow 81st column for this case, though, so the 80th char can be printed without this ill-effect.
    – Kaz
    Commented Oct 19, 2021 at 0:27
  • ... the "shadow 81st colum" meaning that when we print a character in the 80th column, the cursor goes to a 81st column. Then if another character is sent to the terminal at that position, the position will jump to the next line (scrolling if necessary), so the character appears there instead. That allows all 80 colums to be used by a text file, such that it can just be dumped to the terminal.
    – Kaz
    Commented Oct 19, 2021 at 0:29

9 Answers 9


You can thank the IBM punch card for this limit - it had 80 columns:

IBM punch card

  • 73
    After that early teletypes, and later video terminals used 80 columns (and then 132 columns) as a standard width.
    – LapTop006
    Commented May 15, 2012 at 11:43
  • 323
    Now the question is: Why did the IBM punch card have 80 columns? Commented May 15, 2012 at 14:23
  • 164
    @FactorMystic - the punch card size was based on the size of the currency back in the late 1880's's when Hollerith designed them to assist with the 1890's census.
    – user54095
    Commented May 15, 2012 at 14:51
  • 65
    The cards are that size because in 1890, CTR wanted to reuse currency carriers (the dollar was bigger back then) to carry the census data cards.
    – Al Biglan
    Commented May 15, 2012 at 17:30
  • 108
    @AlBiglan Why was currency that size?
    – fredley
    Commented May 15, 2012 at 23:13

As oded mentioned, this common coding standard is a result of the IBM's 1928 80 column punched card format, since many coding standards date back to a time when programs were written on punch cards, one card/line at a time, and even the transition to wider screens didn't alter the fact that code gets harder to read the wider it becomes.

From the wikipedia page on punched cards:

Cultural Impact

  • A legacy of the 80 column punched card format is that a display of 80 characters per row was a common choice in the design of character-based terminals. As of November 2011 some character interface defaults, such as the command prompt window's width in Microsoft Windows, remain set at 80 columns and some file formats, such as FITS, still use 80-character card images.

Now the question is, why did IBM chose 80 column cards in 1928, when Herman Hollerith had previously used 24 and 45 column cards?

Although I can't find a definitive answer, I suspect that the choice was based on the typical number of characters per line of typewriters of the time.

Most of the historical typewriters I've seen had a platen width of around 9 inches, which corresponds with the standardisation of paper sizes to around 8"-8.5" wide (see Why is the standard paper size in the U.S. 8 ½" x 11"? and the History of ISO216 A series paper standard).

Add a typical typewriter pitch of 10-12 characters per inch and that would lead to documents with widths of between 72 and 90 characters, depending on the size of the margins.

As such, 80 characters per line would have represented a good compromise between hole pitch (small rectangular vs. larger round holes) and line length, while maintaining the same card size.

Incidentally, not everywhere specifies an 80 character line width in their coding standards. Where I work has a 132 character limit, which corresponds to the width of typical wide line printers of yore, a 12pt landscape A4 printout and the typical line width remaining in an editor window of Eclipse (maximised on a 1920x1200 screen) after Package Explorer and Outline views are taken into account.

Even so, I still prefer 80 character wide code as it it makes it easier to compare three revisions of a file side-by-side without either scrolling sideways (always bad) or wrapping lines (which destroys code formatting). With 80 character wide code, you only need a 240 character wide screen (1920 pixels at 8 pixels per character) to see a full three-way-merge (common ancestor, local branch and remote branch) comfortably on one screen.

  • 2
    Not to start another speculation-fest, but Hollerith's cards had circular holes, not the rectangles of the IBM 5081 et al. And IBM's later foray into cards, the System/3 format, had 96 circular holes in 3 horizontal bands of columns. Commented May 15, 2012 at 17:44
  • 17
    A good reason to try to continue using 80 characters even on larger screens is that many programmers prefer to use smaller terminal (or even IDE) windows, rather than having to keep them full-screen at all times.
    – rkulla
    Commented Jan 3, 2013 at 17:34
  • 7
    @rkulla So for how many decades will should we continue to impose an 80 character limit? Sure for some languages like C with short identifiers it's fine but for others like C# with long identifiers, it can be a pain. Fortunately, we impose a 132 char limit where I am now but I used to get very annoyed with 80, especially in Python
    – Basic
    Commented Apr 30, 2013 at 15:21
  • 9
    @Basic there is an argument that if you can't work within an 80 character line limit then either your identifiers are excessively verbose or you are trying to do too much on one line. Most people are more comfortable with narrower columns of more lines than very long lines, since our eyes and brains have been trained for years through books, newspapers and column width constrained web pages (like this one) which mean that we find it hard to scan and comprehend very long lines.
    – Mark Booth
    Commented Apr 30, 2013 at 16:46
  • 5
    @MarkBooth I won't drag it out too much as it's a bit of a religious issue but one that gets flagged by PEP8 for being too long is ... ` (8 spaces) return HttpResponse(JsonLib().encode(Ret), content_type="application/json")` and yes it could be broken into multiple lines but it's scattered throughout various controllers and doesn't seem like it's worth splitting up except for meeting the 80-char "standard".
    – Basic
    Commented Apr 30, 2013 at 17:05

While probably not the original reason for the 80 character limit, a reason that it was accepted widely is simply reading ergonomics:

  • If lines are too short, text becomes hard to read because you must constantly jump from one line to the next while reading.
  • If lines are too long, the line jumping becomes too hard because you "lose the line" while going back to the start of the next line (this can be mitigated by having a bigger inter-line spacing, but this also wastes space).

This is widely known and accepted in typography. The standard recommendation (for text in books etc.) is to use something in the region of 40-90 characters per line, and ideally about 60 (see e.g. Wikipedia, Markus Itkonen: Typography and readability.

If you aim for 60 characters per line, your upper limit must obviously be a bit higher to accommodate the occasional long expression (and things like margins markers and line numbers), so having an upper limit of 70-80 makes sense.

This probably explains why the 80 character limit was taken over by many other systems.

  • 4
    I love this answer because it goes beyond specific technology and avoids the pursuit of the "true" original tech.
    – kakyo
    Commented Jan 10, 2019 at 15:33
  • 80 characters per line completely break reading ergonomics. You can see how Wikipedia is best-suited for reading and is particularly wider than other websites (including this one). A general rule is that whatever makes your code to need more scrolling to be read is a bad idea, because you lose context and you have to waste time scrolling in order to read something. I have plenty of code that proves this and I'm working on a formula which calculates a readability index and which proves you're wrong and that short lines are the worst. Commented Mar 30, 2020 at 19:45
  • 3
    @PabloAriel: If you disagree with my answer, feel free to write your own. That's what this site is about.
    – sleske
    Commented Mar 30, 2020 at 20:38
  • Gopher text size is 67 width.
    – DrBeco
    Commented Feb 19, 2022 at 5:40

I'd say that's also because old terminals were (mostly) 80x24 characters in size: Back in the days of 80x24 terminals...


To answer more precisely and more thoroughly to the question, 80 characters is the current "universally accepted" limit to code width inside editors because 80x24 and 80x25 formats were the most common screen modes in early I/O terminals and personal computers (VT52 - thanks to Sandman4).

This limit is still valid and somehow important IMHO for two main reasons: the default geometry that many Linux distros assign to newly spawned terminal windows is still 80x24 and many people use them as-is, without resizing. Moreover, kernel, real-time and embedded programmers often work in a "headless" environment without any window manager. Again, the default screen resolution is often 80x24 (or 80x25), and, in these situations, it may even be difficult to change this default setting.

So if you are a kernel, real-time or embedded programmer you should force yourself to respect this limit, just to be a little more "friendly" towards any programmer that should read your code.

  • 8
    But old terminals were 80 characters wide because of programmers.stackexchange.com/a/148678/4767
    – Oded
    Commented May 15, 2012 at 14:33
  • 10
    -1 for not reading prior answer and for useless link that says just "Back in the days of 80x24 terminals, one of the original authors of a popular unix game was often complimented on how well his code was commented. He said that he had to do that because he always smoked pot when he coded and would lose his train of thought when the screen scrolled."
    – gnat
    Commented May 15, 2012 at 14:40
  • 7
    Sorry for the welcome Avio, you just happened to jump in on a post that's got extremely popular! We do things a little differently from the rest of the internet around here. We hate duplication, amongst other things. Take a read of the faq to get started, hope to see you again!
    – fredley
    Commented May 15, 2012 at 14:51
  • 6
    +1 to justify for downvote. Another +1 (if I could) because 80-character limit for code is because of 80-column terminal and that in turn may or may not be related to punchcards.
    – Sandman4
    Commented May 15, 2012 at 15:00
  • 4
    +1 to counteract @RossPatterson's downvote. There are no citations on any wikipedia references to attribute the 80CPR to the punchcards; that may be completely coincidental, and a commonly accept "truth" that is not actually true. Show me an interview with one of the original engineers who specced the VT52 where he says they were following an IBM punchcard standard. Commented May 15, 2012 at 20:07

A related question is "why has 80 column persisted". Even the responses on this page are approximately that width. I agree with the historical reasons for 80 columns, but the question is why the standard has persisted. I would claim readability - for prose and code. Our minds can only absorb so much information in one piece. I still use the 80 column marker in my code editor to remind me when a statement is getting too long and obscure. It also leaves me plenty of screen real-estate for the browser, and the supporting IDE windows. Long live 80 column - as a guide not a rule.

  • 5
    I've seen the 80-character (approximately) max width mentioned in typography discussions -- apparently it really does help readability, monospace or not.
    – nkorth
    Commented Aug 13, 2012 at 1:40

Another common line length limit in the days of fixed pitch fonts was 72 characters. Examples: Fortran code, mail, news.

One reason was that columns 73-80 of a punch card were often reserved for a serial number. Why a serial number? If you dropped a card deck, you could pick the cards up in any order, line up the upper left corners (which always had a diagonal cut) and use a card sorting machine to get them back in order.

Another reason for the 72-character limit was that common fonts were 10 points high and 6 points (1/12") wide. An A4 or 8.5" wide page could hold 72 characters in a 6" wide column and still have room for margins of over an inch.


I personally stick to "about column 80" for my end of line because further than that causes wrapping or lost code when you print it.

There's punch card legacy as well, but I don't think laser printers or 8.5x11 inch paper was set to conform to punch card limitations.

  • As I suggest in my answer @CMike, I do think that it is possible that the punch card width is related to the size of typewriter platens and thus paper sizes (or vice versa).
    – Mark Booth
    Commented Mar 31, 2014 at 23:02
  • So, you order the code for the least common use case? Commented Mar 30, 2020 at 19:49
  • Do you print code? Why?
    – gnasher729
    Commented Oct 19, 2021 at 22:06

Scroll in printers papers were Letters size or 15" wide.

It were the 80 cps line printers for hardcopying of codes or reports, and later on Epson supports 132 cps condensed printing (escape code \015 for condensed print).

  • Especially when it's written (several times!) on this page!
    – fredley
    Commented May 15, 2012 at 17:46
  • 12
    @Ross: you should not downvote anybody for not knowing something on Q&A site! Commented May 15, 2012 at 18:30
  • 6
    @abatishchev - but the answer being referred to is on this page.
    – ChrisF
    Commented May 15, 2012 at 20:35
  • 10
    @abatishchev Actually, that's exactly the idea of StackExchange sites. "Good" answers should be upvoted, and "bad" answers should be downvoted, to ensure that future readers who may not be able to judge for themselves can know the community's opinion of the answers. Commented May 15, 2012 at 22:54
  • 2
    @abatishchev It isn't about voting down answers you don't like, it's about voting down answers which aren't useful. See the mouse-over text of the voting buttons.
    – Mark Booth
    Commented Mar 31, 2014 at 23:04

One of the reasons for the 80 column cards may be associated with the 'hand punch' which was probably in use before the electronic card punch machines. It is one which I used in the early 70s on an ICL System 4-50 main frame computer site. One had to punch a section of three? punch knives in the carriage at the same time.

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