Pascal's Triangle Calculator

Draw Pascal's triangle, pull out any single row exactly, or color the entries by divisibility to reveal the patterns hidden inside it.

Show
Rows 0 to (rows − 1), up to 30.
Rows shown
0 to 9
Numbers shown
55
Largest number
126C(9, 4), the middle of the last row
Odd numbers
33
Sum of everything shown
1,0232¹⁰ − 1
Row 9 adds up to5122⁹ · row n always sums to 2ⁿ

Show the work

  1. Row 0 is a single 1, and every row begins and ends with 1.
  2. Every other number is the sum of the two numbers diagonally above it. Building row 9 from row 8: 1 + 8 = 9, 8 + 28 = 36, 28 + 56 = 84, and so on.
  3. The number in row n, position k (both counted from 0) is the binomial coefficient C(n, k) = n!k! · (n − k)!. For example, the middle of row 9 is C(9, 4) = 9!4! · 5! = 126.
  4. Each row adds up to a power of 2, because every number feeds the two numbers below it. Row 9: 1 + 9 + 36 + 84 + 126 + 126 + 84 + 36 + 9 + 1 = 2⁹ = 512.
Row facts
Row nSum (2ⁿ)Middle numberOdd numbers
0111
1212
2422
3834
41662
532104
664204
7128358
8256702
95121264

Pascal’s triangle is a triangular table of numbers in which each entry is the sum of the two entries above it. Simple as that rule is, the triangle holds the binomial coefficients, the counts of combinations, the powers of 2, the triangular numbers, the Fibonacci numbers and a famous fractal. This calculator draws the triangle up to 30 rows, gives any single row up to row 1,000 with every digit exact, and colors entries by divisibility so the patterns stand out.

How to use the Pascal’s triangle calculator

  1. Under Show, choose Triangle, One row or Divisibility pattern.
  2. For the triangle, enter the Number of rows (1 to 30). Tick Highlight odd numbers to shade the odd entries. Hover over a number to see its C(n, k) label.
  3. For a single row, enter the Row number (n). Optionally enter a Position in the row (k) to get that entry exactly on the tape; leave it blank for the middle entry.
  4. For the pattern, enter up to 128 rows and a Divisor (m). Entries that are not multiples of m are colored, and the rest are gray.

Pascal’s triangle formula

Each entry is a binomial coefficient, and neighboring entries satisfy Pascal’s rule:

C(n, k) = C(n − 1, k − 1) + C(n − 1, k)    C(n, k) = n! ÷ (k! (n − k)!)

To build one row on its own, move left to right with

C(n, k + 1) = C(n, k) × (n − k) ÷ (k + 1)

which is how the calculator produces row 1,000 without computing any huge factorial.

Worked example: row 10

Start with 1 and apply the row rule for n = 10:

1 × 10 ÷ 1 = 10,   10 × 9 ÷ 2 = 45,   45 × 8 ÷ 3 = 120,   120 × 7 ÷ 4 = 210,   210 × 6 ÷ 5 = 252

The row is symmetric, so row 10 is 1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1.

Check: the numbers add to 1,024 = 210.

The middle entry, 252 = C(10, 5), is the number of ways to choose 5 items from 10, which you can confirm with the combinations calculator.

Patterns hidden in the triangle

  • Diagonals. The outer diagonals are all 1s. The next diagonal is 1, 2, 3, 4, … (the counting numbers), then 1, 3, 6, 10, 15, … (the triangular numbers), then 1, 4, 10, 20, 35, … (the tetrahedral numbers).
  • Hockey stick. Add entries down a diagonal and the total sits just below the end, off to the side: 1 + 3 + 6 = 10, that is C(2, 2) + C(3, 2) + C(4, 2) = C(5, 3).
  • Fibonacci numbers. Sums along the shallow diagonals give 1, 1, 2, 3, 5, 8, 13, … — the Fibonacci sequence.
  • Powers of 11. Rows 0 to 4 read as numbers are 1, 11, 121, 1331 and 14641, the powers of 11. From row 5 on, carrying digits breaks the pattern.
  • Odd entries. Row n has 2ˢ odd numbers, where s is the number of 1s in n written in binary. Row 10 is 1010 in binary, so it has 2² = 4 odd entries: 1, 45, 45, 1.
  • Primes. If n is prime, every entry of row n except the two 1s is divisible by n, as row 7 (1, 7, 21, 35, 35, 21, 7, 1) shows.

Binomial expansion

Row n gives the coefficients of (a + b)ⁿ:

(a + b)5 = a5 + 5a4b + 10a3b2 + 10a2b3 + 5ab4 + b5

Setting a = b = 1 shows again why row 5 adds up to 2⁵ = 32. Setting a = 1 and b = −1 shows the alternating sum of any row after row 0 is 0.

The divisibility pattern

Coloring the entries that are not divisible by 2 draws the Sierpiński triangle: the first 2ᵏ rows hold exactly 3ᵏ odd numbers, so 32 rows contain 243 odd entries out of 528. Prime divisors such as 3 or 5 give their own self-similar patterns, a consequence of Lucas’s theorem on binomial coefficients modulo a prime.

A triangle with many discoverers

The triangle is named after Blaise Pascal, whose Traité du triangle arithmétique was written in 1654 and published in 1665; he used it to solve problems about dividing the stakes of an unfinished game, an early step in probability theory. It was known much earlier: the Chinese mathematician Yang Hui described it in 1261, crediting the eleventh-century scholar Jia Xian, and it appears in the work of al-Karaji and Omar Khayyam in Persia. In China it is still called Yang Hui’s triangle, and in Italy Tartaglia’s triangle.

Frequently asked questions

How is Pascal's triangle built?

Start with a single 1 at the top (row 0). Each row begins and ends with 1, and every other number is the sum of the two numbers diagonally above it. Row 4, for example, is 1, 4, 6, 4, 1.

How do I find a number in Pascal's triangle without drawing it?

The number in row n at position k, both counted from 0, is the binomial coefficient C(n, k) = n! ÷ (k!(n − k)!). The middle of row 10 is C(10, 5) = 252.

Why does each row add up to a power of 2?

Every number is passed down to the two numbers below it, so each row's total is exactly double the row above. Starting from 1 in row 0, row n adds up to 2ⁿ. It also counts subsets: an n-item set has 2ⁿ subsets.

What does Pascal's triangle have to do with (a + b)ⁿ?

Row n lists the coefficients of the expanded power. (a + b)³ = a³ + 3a²b + 3ab² + b³ uses row 3: 1, 3, 3, 1.

Why do the odd numbers form the Sierpiński triangle?

Working modulo 2, the addition rule becomes exclusive-or, and the first 2ᵏ rows split into three copies of the first 2ᵏ⁻¹ rows with an all-even triangle in the middle. Repeating that split forever produces the Sierpiński pattern.

Last reviewed October 2026 by the CalcFluent editorial team. How we check our calculators.