Bresenham's line algorithm (1962)
JAEV Notes · October 2026 · 3 min read
Bresenham's line algorithm decides which points of a grid a machine should step through to draw a straight line, using only whole numbers. Jack Bresenham wrote it at IBM in 1962 for a pen plotter and published it in 1965 in the IBM Systems Journal as "Algorithm for computer control of a digital plotter".1, 2 On a screen the grid points are pixels, and the same rule picks which pixels to fill.2
The problem
The plotter in Bresenham's paper answers each electrical pulse with one of eight moves: one step left, right, up or down, or one step along a diagonal. In his words, "the plotter can move linearly from a point on a mesh to any adjacent point on the mesh". A drawing is given as points on that mesh, joined by straight segments.1
A segment that is not horizontal, vertical or at 45 degrees can only be drawn as a staircase of these moves, and before every step the computer must choose the next one. Bresenham's rule is to take, each time, "the mesh point nearest the desired line segment".1
How it works
Take a line from D1 to D2 that rises less steeply than 45 degrees, the paper's "first octant". Let Δa be the number of mesh steps across and Δb the number up. Every move is then either one step across (M1) or one step diagonally across and up (M2).1 The program keeps a single whole number, the decision value ∇:
- Start with ∇ = 2Δb − Δa.
- If ∇ is negative, move one step across and add 2Δb.
- Otherwise, move diagonally and add 2Δb − 2Δa.
- Repeat until the pen has made Δa moves.
Bresenham shows that ∇ always has the same sign as the difference between the distances from the line to the two possible next points, so its sign alone tells which point is nearer.1 Lines in the other seven directions are handled by swapping the axes or reversing the direction.2
Inside the loop there is only addition, subtraction and a comparison. The algorithm, the paper says, "may be programmed without multiplication or division instructions and is efficient with respect to speed of execution and memory utilization".1 A 1962 description of the program states that 333 core memory locations were enough.3
The machines
In an account from 2001, Bresenham said he was working in the computation lab at IBM's San Jose development lab, where "a Calcomp plotter had been attached to an IBM 1401 via the 1407 typewriter console", and that the algorithm was in production use by the summer of 1962.2 The volunteers who restore IBM 1401 computers at the Computer History Museum have since gathered 1962 documents. One describes "an IBM 1401 program (used to control an IBM 1627)", the name under which IBM sold CalComp's drum plotters; Robert Garner reports that the lab used the 11-inch CalComp 565. The same page lists what is still uncertain, among it whether the program listing that survives is complete.3
Still a plotter problem
A pen plotter is still told to draw straight segments between points, in a language such as HP-GL, and the machine has to turn each one into movement. Every drawing in Olof Broström's Unverified Air at JAEV is stored as such a file for a pen plotter, in black, red and blue ink.4 See also Plotter art and Plotter path optimisation.
Amit Patel of Red Blob Games, whose copy of Bresenham's paper we first used, pointed us in October 2026 to the open-access version from the ACM (source 5).
Sources
- J. E. Bresenham, “Algorithm for computer control of a digital plotter”. IBM Systems Journal 4:1 (1965), pp. 25–30 (scan)
“The algorithm may be programmed without multiplication or division instructions and is efficient with respect to speed of execution and memory utilization.” Eight linear movements; “A typical mesh size is 1/100th of an inch.” “the mesh point nearest the desired line segment is selected.” ∇1 = 2Δb − Δa; ∇i+1 = ∇i + 2Δb − 2Δa if ∇i ≥ 0, ∇i + 2Δb if ∇i < 0. Footnote 1: based on “An incremental algorithm for digital plotting”, ACM National Conference, Denver, 30 August 1963. DOI 10.1147/sj.41.0025. - “Bresenham's line algorithm”. Wikipedia
Bresenham in 2001: “I was working in the computation lab at IBM's San Jose development lab. A Calcomp plotter had been attached to an IBM 1401 via the 1407 typewriter console.” In production use by summer 1962. For each column the pixel row nearest the line; integer addition, subtraction and bit shifts only; other octants by swapping and reversing. - “Bresenham line drawing and the IBM 1627”. IBM 1401 restoration project, Computer History Museum
1962 paper quoted: “333 core locations were sufficient for an IBM 1401 program (used to control an IBM 1627)”. IBM 1627 Model 1 = Calcomp 565 (11 inches wide). Robert Garner: the lab used the 565; questions whether the code found is complete; 1962 documents scanned in August 2023. - Olof Broström, Unverified Air, 2026–2027. JAEV
“stored as a file for a pen plotter, in black, red and blue ink”.
- Published
- JAEV Notes, October 2026.
- Use
- Text CC BY 4.0. Free to use and quote with credit to JAEV and a link to this page. Images and quotations by others keep their own terms.
All texts as one file: archive.json - Cite
- JAEV Notes, “Bresenham's line algorithm (1962)”, jaev.gallery/notes/bresenham-line-algorithm/, 2026.
- Corrections
- Additions and corrections are welcome: info@jaev.gallery
- Share
A link from your own site, course page or reading list helps others find it.- Follow
- New notes by RSS · Instagram · Bluesky
JAEV is a daemon taking shape: machines, weights, room, brain.