Crossing Number Calculator

Find the fewest edge crossings needed to draw the complete graph Kₙ or the complete bipartite graph Kₘ,ₙ in the plane. Exact for any size up to a million vertices, with an optimal drawing that marks and counts every crossing.

Calculator Numbers & Math Updated Oct 13, 2026
Learn how this works
How to Use
  1. Choose the graph: Complete Kₙ (every vertex joined to every other) or Bipartite Kₘ,ₙ (every one of m vertices joined to every one of n).
  2. Enter n, and m for the bipartite graph, as whole numbers from 1 to 1,000,000. The answer updates as you type.
  3. Or press a preset, such as K₃,₃ for the three-utilities puzzle or K₇,₁₀ for 7 kilns and 10 storage yards.
  4. Read the minimum number of crossings, the edge and vertex counts and whether that size was proved before 2026 or only by the 2026 proof.
  5. For up to 16 vertices (Kₙ) or 14 per side (Kₘ,ₙ) the panel draws an optimal layout, marks each crossing in red and counts them, so you can see the formula is reached. Show Work lists every step.
Input
vertices
Presets
Optimal Drawing
Crossings
—
Edges
—
Vertices
—
Formula status
—

Enter a size to see the minimum number of crossings.

Worked Example

K8, eight points all joined to each other. It has 8 × 7 / 2 = 28 edges. Hill’s formula takes four floors: ⌊8/2⌋ = 4, ⌊7/2⌋ = 3, ⌊6/2⌋ = 3, ⌊5/2⌋ = 2. Then cr(K8) = ¼ × 4 × 3 × 3 × 2 = 72 / 4 = 18.

K5,5, five kilns and five storage yards. Each side gives ⌊5/2⌋ × ⌊4/2⌋ = 2 × 2 = 4, so cr(K5,5) = 4 × 4 = 16, with 25 edges.

The common mistakes. Dropping the floors turns the formula into n(n−1)(n−2)(n−3)/64, which for K7 gives 840 / 64 = 13.125 instead of the true 9 (¼ × 3 × 3 × 2 × 2). And drawing the points on a circle with straight lines, the obvious picture, is far from optimal: every 4 points give one crossing, so K8 drawn that way has C(8,4) = 70 crossings, not 18.

Show Work

Enter values and calculate to see the step-by-step breakdown.

Formulas

Complete graph (Hill)
cr(Kn) = ¼ ⌊n/2⌋ ⌊(n−1)/2⌋ ⌊(n−2)/2⌋ ⌊(n−3)/2⌋
The Harary–Hill formula, often written H(n). It is 0 for n ≤ 4.
Same formula by parity
n = 2s+1: (s(s−1)/2)²   n = 2s: s(s−1)²(s−2)/4
K11 (s = 5): 10² = 100. K12 (s = 6): 6 × 25 × 4 / 4 = 150.
Complete bipartite graph (Zarankiewicz)
cr(Km,n) = ⌊m/2⌋ ⌊(m−1)/2⌋ ⌊n/2⌋ ⌊(n−1)/2⌋
Often written Z(m, n). It is 0 when m ≤ 2 or n ≤ 2, and K3,n needs ⌊n/2⌋ ⌊(n−1)/2⌋.
Edges
|E| = n(n−1)/2   or   m × n
Kn joins every pair of its n vertices; Km,n joins each of m vertices to each of n.
Points on a circle (not optimal)
C(n, 4) = n(n−1)(n−2)(n−3)/24
Straight lines between points in convex position: each set of 4 points gives exactly one crossing.

Background: From a Brick Factory to a 2026 Proof

The brick factory. Pál Turán posed the bipartite problem from his own experience: in forced labour at a brick factory near Budapest in 1944, wagons ran on rails from every kiln to every storage yard, and they were hardest to push where the rails crossed. He told the story in “A note of welcome” in the first issue of the Journal of Graph Theory (1977). Asking for the fewest crossings is asking for the crossing number of Km,n.

Zarankiewicz’s drawing and the gap. Kazimierz Zarankiewicz (Fundamenta Mathematicae 41, 1954), and independently Kazimierz Urbanik, put the m vertices on the x-axis and the n vertices on the y-axis, split as evenly as possible either side of the origin, and joined them with straight lines. That drawing has exactly Z(m, n) crossings, and it is the drawing on this page. Both also published proofs that nothing better is possible, but the proofs had an error that Gerhard Ringel and Paul Kainen found in the mid-1960s; Richard Guy told the story in “The decline and fall of Zarankiewicz’s theorem” (1969). From then on, Z(m, n) was a conjecture.

The complete graph. Frank Harary and Anthony Hill (1963) described Hill’s drawing of Kn and conjectured that its count, H(n), is the minimum; Richard Guy had published the same upper bound in 1960. Drawings with all vertices on one line and every edge above or below it (two-page drawings) also reach H(n). The one drawn here puts vertices 0 to n−1 on a line and draws edge {i, j} above the line when (i + j) mod n is less than n/2, below otherwise; the script counts its crossings each time and checks the total against H(n).

Cases proved before 2026. Daniel Kleitman (1970) proved Zarankiewicz’s formula whenever the smaller side has at most 6 vertices. Douglas Woodall (1993), using computer searches, extended it to a smaller side of 7 or 8 when the other side has at most 10 vertices. Shengjun Pan and Bruce Richter (2007) proved cr(K11) = 100 with computer help, which gives cr(K12) = 150, so Hill’s formula was known for every n ≤ 12. For K13, Schaefer’s 2026 survey lists the value only as one of 219, 221, 223 or 225; Oswin Aichholzer reported a computer-assisted proof of 225 (and 315 for K14) at a 2021 conference. For large n the best general lower bound was just over 98.5% of H(n).

New in 2026. On 23 September 2026 OpenAI published two AI-generated preprints, “The crossing number of complete graphs” and “The crossing number of complete bipartite graphs” (result family #165 in its openai/math repository), that claim both formulas for every size. Its Lean scope note says the formalization proves cr(Kn) = H(n) for every n ≥ 3, with a lower bound and a matching two-page drawing, and cr(Km,n) = Z(m, n) for all positive m and n, counting crossings as points in the plane, so two edges that cross twice count twice. In other words, it is proved in a 2026 AI-generated preprint with a machine-checked Lean proof (published with Lean Comparator checks), and it has not yet been peer reviewed. What a Lean check does and does not establish is explained in what “Lean-checked” means. This calculator labels sizes settled before 2026 as proven (classical) and the rest as proven in 2026 (AI-generated, Lean-checked).

Straight lines are not always enough. If every edge must be a straight segment, Kn can need more: 19 for K8, 62 for K10, 102 for K11 and 153 for K12, against 18, 60, 100 and 150 with curves (at n = 9 both are 36). That is why the Kn drawing here uses arcs. Zarankiewicz’s Km,n drawing is straight already.

Sources

About This Calculator

This calculator gives the crossing number of the complete graph Kn and the complete bipartite graph Km,n: the fewest pairs of edges that must cross when the graph is drawn on a flat sheet. It uses exact integer arithmetic, so K1,000,000 comes out to the last digit (about 1.56 × 1022) rather than rounded.

It does not only quote the formula. For small sizes it draws a layout that reaches the minimum, marks every crossing, counts them with an exact geometric test and shows whether the count matches. It also says which sizes were proved by classical methods and which rest on the 2026 proof.

All calculations run in your browser; nothing you enter is sent to a server.

It is meant for students and teachers of graph theory, puzzle fans looking at the utilities problem, and anyone laying out wiring or network diagrams who wants to know how many crossings cannot be avoided.

Related calculators: Graph Algorithm Laboratory, Permutation and Combination Calculator, and Big Number Calculator.

Frequently Asked Questions

What is the crossing number of K₅ and K₆?

cr(K₅) = 1 and cr(K₆) = 3. By Hill's formula, K₅ gives ¼ × 2 × 2 × 1 × 1 = 1 and K₆ gives ¼ × 3 × 2 × 2 × 1 = 3. K₄ and smaller can be drawn with no crossings at all.

Can the three-utilities puzzle be solved?

Not on a flat sheet. Joining 3 houses to 3 utilities is the graph K₃,₃, and Zarankiewicz's formula gives ⌊3/2⌋ × ⌊2/2⌋ × ⌊3/2⌋ × ⌊2/2⌋ = 1, so at least one pair of lines must cross. One crossing is enough, as the drawing shows.

Are the Hill and Zarankiewicz formulas proved?

For small sizes, yes: Kₙ up to n = 12 (Pan and Richter, 2007) and Kₘ,ₙ whenever the smaller side has at most 6 vertices (Kleitman, 1970), or 7 or 8 with the other side at most 10 (Woodall, 1993). In September 2026 an AI-generated preprint from OpenAI claimed proofs for every size, with a machine-checked Lean proof. It has not yet been peer reviewed.

Do straight-line drawings need more crossings?

For complete graphs, sometimes. With straight edges K₈ needs 19 crossings instead of 18, K₁₀ needs 62 instead of 60 and K₁₂ needs 153 instead of 150 (OEIS A014540); at n = 9 both are 36. For Kₘ,ₙ, Zarankiewicz's drawing already uses straight edges.

How fast does the crossing number grow?

Roughly as n⁴/64 for Kₙ and m²n²/16 for Kₘ,ₙ. K₁₀₀ needs 1,440,600 crossings, close to 100⁴/64 = 1,562,500. Doubling n multiplies the crossings by about 16, while the number of edges only grows about 4 times.

How do I use the Crossing Number Calculator?

Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.

Is it free? Does it work without internet?

Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.

Where does my data go?

Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.

Common Use Cases

The three-utilities puzzle

Water, gas and electricity to 3 houses is K₃,₃: at least 1 crossing, so the puzzle has no flat solution.

Turán's brick factory

Rails from 7 kilns to 10 storage yards (K₇,₁₀) must cross at least 180 times, however they are laid out.

Single-layer circuit boards

Wiring each of 4 pins to each of 7 pads on one layer is K₄,₇: at least 18 crossings, each needing a jumper or a second layer.

Network diagrams

A diagram of 8 fully connected nodes has 28 links and needs at least 18 crossings; a neat octagon with straight lines has 70.

Checking homework

cr(K₉) = 36 and cr(K₅,₆) = 2 × 2 × 3 × 2 = 24, with each floor shown in Show Work.

Last updated: