# Tupper's self-referential formula

**Tupper's self-referential formula** is an inequality published by the computer scientist Jeff Tupper in 2001 which, when plotted over a particular 106-by-17 block of pixels, draws a bitmap picture of the inequality itself. The name is a misnomer: the formula is not genuinely self-referential, and Tupper did not call it self-referential in his paper. Its graph over the full plane contains every possible 106 × 17-pixel black-and-white bitmap, and the famous "self-portrait" is simply one of them, located at a specific 543-digit height on the y-axis.<sup>[1](https://arxiv.org/abs/2504.00006)</sup>

| Key fact | Detail |
|---|---|
| Origin | Example in Jeff Tupper's paper "Reliable Two-Dimensional Graphing Methods for Mathematical Formulae with Two Free Variables", ACM SIGGRAPH 2001<sup>[2](https://www.dgp.toronto.edu/papers/jtupper_SIGGRAPH2001.pdf)</sup> |
| The formula | \( \tfrac{1}{2} < \left\lfloor \operatorname{mod}\left( \left\lfloor \tfrac{y}{17} \right\rfloor \cdot 2^{-17\lfloor x \rfloor - \operatorname{mod}(\lfloor y \rfloor, 17)}, 2 \right) \right\rfloor \)<sup>[3](https://staff.math.su.se/hoehle/blog/2022/10/17/tupper.html)</sup> |
| Plotting window | Evaluated for \( 0 \leq x \leq 105 \) and \( k \leq y \leq k+16 \), it produces a 106 × 17 binary image<sup>[3](https://staff.math.su.se/hoehle/blog/2022/10/17/tupper.html)</sup> |
| Famous constant | A 543-digit integer beginning 960939379918958884971672962127852754715004339660129306651505519271702802395266424689642842174350718121267153782770623355993237280874144307891325963941337723487857735749823926629715517173716995165232890538221612403238855866184013235585136048828693337902491454229288667081096184496091705183454067827731551705405381627380967602565625016981482083418783163849115590225610003652351370343874461848378737238198224849863465033159410054974700593138339226497249461751545728366702369745461014655997933798537483143786841806593422227898388722980000748404719<sup>[4](https://chalkdustmagazine.com/blog/tuppers-formula/)</sup> |
| Encoding | \( k = 17 \sum_{i=1}^{1802} p_i \, 2^{i-1} \), where the pixels \( p_i \) are numbered from the bottom-left corner, up each column and on to the next<sup>[5](https://prathameshnium.github.io/TupperTransformer/)</sup> |
| True status | Not self-referential; the graph contains every possible 106 × 17-pixel bitmap, and the constant \( k \) is not part of the plotted image<sup>[1](https://arxiv.org/abs/2504.00006)</sup> |
| Generalization | Somu and Mishra extended the construction to \( m \) colors and \( n \) dimensions (Discrete Mathematics, 2023)<sup>[6](https://arxiv.org/abs/2109.11013)</sup> |

## The formula and how it is plotted

The inequality maps each point \( (x, y) \) to a Boolean value: it holds or it does not. To plot it, the plane is divided into a grid of unit squares, and a square is shaded black when the inequality holds there and left white otherwise. The operators are elementary: \( \operatorname{mod}(a,b) \) is the remainder when \( a \) is divided by \( b \), and the floor function \( \lfloor \cdot \rfloor \) returns the largest integer less than or equal to its input.<sup>[4](https://chalkdustmagazine.com/blog/tuppers-formula/)</sup>

Because the right-hand side can only be 0 or 1, the comparison with \( \tfrac{1}{2} \) serves mainly to produce a Boolean rather than a 0/1 value, and for integer inputs the floor operators around \( x \) and \( y \) are redundant.<sup>[3](https://staff.math.su.se/hoehle/blog/2022/10/17/tupper.html)</sup> The inequality can in fact be reduced to plain integer bit operations: it simply extracts individual bits from an encoded image number, where \( K = \text{IMG} \times 17 \).<sup>[7](https://devblogs.co/posts/demystifying-tuppers-formula/)</sup>

## How the encoding works

The entire effect is an unpacking of a bitmap stored as a number. A 106 × 17 grid holds \( 106 \times 17 = 1802 \) pixels. Numbering the pixels \( p_1, p_2, \dots \) from the bottom-left corner, going up each column and then on to the next, the constant is

\[ k = 17 \sum_{i=1}^{1802} p_i \, 2^{i-1}. \]

In other words, the 1802-bit binary number read off the image is converted to base 10 and multiplied by 17.<sup>[5](https://prathameshnium.github.io/TupperTransformer/)</sup><sup> • </sup><sup>[3](https://staff.math.su.se/hoehle/blog/2022/10/17/tupper.html)</sup> The multiplication by 17 (10001 in binary) ensures that taking \( k \) modulo the image height starts the window at zero, and it helps preserve trailing zeroes in the encoding when the leading pixels are blank.<sup>[3](https://staff.math.su.se/hoehle/blog/2022/10/17/tupper.html)</sup>

To recover the image from a given \( k \), one converts \( k/17 \) to binary, pads it to 1802 bits, and reads the bits back off the grid. Because \( k \) has roughly 500 to 543 decimal digits, implementations require arbitrary-precision integer arithmetic, such as the GNU Multiple Precision Arithmetic Library.<sup>[3](https://staff.math.su.se/hoehle/blog/2022/10/17/tupper.html)</sup>

## An everything formula, not a self-referential one

Scrolling along the y-axis, the formula plots every bitmap that fits in a 106 × 17 grid, each at its own \( k \). [Euler's identity](https://www.edgepedia.org/eulers-identity), the [Gaussian integral](https://www.edgepedia.org/gaussian-integral), and any other image of that size appear somewhere in the graph at computable heights.<sup>[4](https://chalkdustmagazine.com/blog/tuppers-formula/)</sup> This is why commentators describe it as an "everything formula": the self-portrait is not a miracle but a consequence of the graph containing all possible images of that size, including several renderings of the formula itself.<sup>[8](https://jtra.cz/stuff/essays/math-self-reference-smooth/)</sup>

It is also not truly self-referential, since the number \( k \) needed to find the right viewport is not included inside the plotted image.<sup>[8](https://jtra.cz/stuff/essays/math-self-reference-smooth/)</sup> Samuel Allen Alexander, a mathematician who completed his Ph.D. in mathematical logic at The Ohio State University in 2013, notes that Tupper's so-called self-referential formula is not self-referential at all, nor did Tupper himself call it that; it is a formula whose graph contains every possible 106 × 17-pixel bitmap.<sup>[1](https://arxiv.org/abs/2504.00006)</sup> The idea nevertheless became internet-famous when a [Wikipedia](https://www.edgepedia.org/wikipedia) article on the formula went viral in 2012.<sup>[1](https://arxiv.org/abs/2504.00006)</sup>

## Genuinely self-referential successors

Tupper later posted formulas that are actually self-referential on his website, with file timestamps indicating 2007, though these received less attention than the 2001 example.<sup>[1](https://arxiv.org/abs/2504.00006)</sup><sup> • </sup><sup>[8](https://jtra.cz/stuff/essays/math-self-reference-smooth/)</sup> Jakub Trávník, who produced his own full self-referential formula in 2011, published in February 2019 a smooth variant based on Bézier curves rather than bitmaps, so it can be zoomed without pixelation; its constant \( N \) has 50,930 decimal digits and the complete rendered image measures 1750 × 18625 pixels.<sup>[8](https://jtra.cz/stuff/essays/math-self-reference-smooth/)</sup>

The bitmap approach has also been generalized mathematically. Sai Teja Somu and Vidyanshu Mishra proved that for any \( n \)-dimensional object of \( m \) colors representable by hypervoxels in an array of dimensions \( A_1 \times \cdots \times A_n \), there exist \( m \) formulae in \( n \) free variables and a natural number \( k \) such that the union of their colored graphs over the appropriate range is exactly that object; the original formula is the case of one color and two dimensions.<sup>[6](https://arxiv.org/abs/2109.11013)</sup>

## Arithmetic on the image

Because \( k \) is a sum of one term per pixel, ordinary arithmetic on \( k \) transforms the plotted image. Adding or subtracting \( 17 \times 2^{i-1} \) adds or removes pixel \( i \), which is exactly what drawing on an interactive plot does. Multiplying \( k \) by \( 2^n \) or dividing by \( 2^n \) moves the image \( n \) pixels up or down, and multiplying or dividing by \( 2^{17n} \) moves it \( n \) columns left or right.<sup>[5](https://prathameshnium.github.io/TupperTransformer/)</sup>

## Context in Tupper's work

The formula appeared only as an example in Tupper's SIGGRAPH 2001 paper, whose actual subject is a family of algorithms for reliably graphing two-dimensional implicit equations and inequalities using interval arithmetic, implemented in the graphing software GrafEq. The paper's concern is correctness: the algorithms assign a clear meaning to each computed pixel and never produce incorrect graphs, marking clearly any pixels they cannot decide.<sup>[2](https://www.dgp.toronto.edu/papers/jtupper_SIGGRAPH2001.pdf)</sup> The self-portrait inequality was, in the paper's own terms, merely one of the graphs the method could handle.<sup>[9](https://shreevatsa.wordpress.com/2011/04/12/how-does-tuppers-self-referential-formula-work/)</sup>

## References

1. [Samuel Allen Alexander (2025). Self-graphing equations. arXiv:2504.00006; also in ACMS Conference Proceedings 2024.](https://arxiv.org/abs/2504.00006)
2. [Jeff Tupper (2001). Reliable Two-Dimensional Graphing Methods for Mathematical Formulae with Two Free Variables. ACM SIGGRAPH 2001 Conference Proceedings.](https://www.dgp.toronto.edu/papers/jtupper_SIGGRAPH2001.pdf)
3. [Michael Höhle (2022). Tupper's Self Referential Formula in R.](https://staff.math.su.se/hoehle/blog/2022/10/17/tupper.html)
4. [Harmeet Singh (2017). Tupper's self-referential formula. Chalkdust magazine.](https://chalkdustmagazine.com/blog/tuppers-formula/)
5. [Prathamesh Deshmukh. TupperTransformer: An Interactive Demo of Tupper's Self-Referential Formula.](https://prathameshnium.github.io/TupperTransformer/)
6. [Sai Teja Somu, Vidyanshu Mishra (2021). On a Generalization of Tupper's Formula for m Colours and n Dimensions. arXiv:2109.11013; Discrete Mathematics 346(12), 2023.](https://arxiv.org/abs/2109.11013)
7. [Eli Bendersky. Demystifying Tupper's formula. devblogs.sh.](https://devblogs.co/posts/demystifying-tuppers-formula/)
8. [Jakub Trávník (2019). Trávník's smooth self-referential formula.](https://jtra.cz/stuff/essays/math-self-reference-smooth/)
9. [Shreevatsa R (2011). How does Tupper's self-referential formula work? The Lumber Room.](https://shreevatsa.wordpress.com/2011/04/12/how-does-tuppers-self-referential-formula-work/)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Logic and discrete mathematics › Formal logic and foundations › Foundations of mathematics › Limitative theorems and independence › Diagonalization and self-reference methods*

*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
