I often have to generate binomial coefficients so I created this simple online utility that does it for me. It lets you calculate the coefficients of the binomial expansion of one or more binomial powers. It works in the browser and is powered by alien technology from the future.

Binomial Coefficients Generator Options

Starting Power and Count
Output Format
Center all binomial coefficients.
Generate binomial coefficients starting from the highest power to the lowest power.

Binomial Coefficients Generator Examples (click to try!)

Eight Rows of Binomial Coefficients
This example calculates binomial coefficients for eight consecutive polynomial powers of the form (a+b)n. It starts from (a+b)0 and ends with (a+b)7, which is a total of eight powers of n. The coefficients are printed centered and they form the pretty Pascal's triangle.
         1         
        1 1        
       1 2 1       
      1 3 3 1      
     1 4 6 4 1     
   1 5 10 10 5 1   
 1 6 15 20 15 6 1  
1 7 21 35 35 21 7 1
Start generating binomial coefficients from this power.
How many consecutive powers to generate coefficients for?
Centered Coefficients
Reverse Power Order
Coefficients for Power 20
In this example, we generate the binomial coefficients for the polynomial expansion of the binomial power (a+b)20. In the output, we get all the coefficients for this power separated by spaces.
1 20 190 1140 4845 15504 38760 77520 125970 167960 184756 167960 125970 77520 38760 15504 4845 1140 190 20 1
Start generating binomial coefficients from this power.
How many consecutive powers to generate coefficients for?
Centered Coefficients
Reverse Power Order
Decreasing Powers
In this example, we generate binomial coefficients in reverse order. To do it, we've selected the reverse-power-order option that starts calculating and printing the coefficients from the highest power (in this case 8) and goes to the lowest (in this case 0).
1 8 28 56 70 56 28 8 1
1 7 21 35 35 21 7 1
1 6 15 20 15 6 1
1 5 10 10 5 1
1 4 6 4 1
1 3 3 1
1 2 1
1 1
1
Start generating binomial coefficients from this power.
How many consecutive powers to generate coefficients for?
Centered Coefficients
Reverse Power Order

How Does This Binomial Coefficients Generator Work?

This binomial coefficient calculator works entirely in your browser and is written in JavaScript. To generate binomial coefficients, it creates a two-dimensional array of coefficients called coefs and initializes it to values [[1], [1, 1]], which correspond to the first two rows of binomial powers. To calculate the next row, it assigns the current row to a variable curRow and starts a simple for loop over every consecutive pair of values of curRow, finds their sum curRow[i] + curRow[i+1] and push()es them to an empty newRow array. Then it copies the outer values curRow[0] and curRow[n-1] from the current row and puts them at both ends of the newRow array. To calculate count (number of binomial expansion powers to calculate; specified in options), this algorithm is repeated count times. After every loop iteration, curRow is push()ed at the end of the coefs array. When the algorithm finishes, all coefficients get join()ed by the space character. If the center-coefficients option is selected, then it also calls centerString() function for this row of coefficients. If the reverse-powers option is selected, then coefs are first reversed via coefs.reverse() function and all rows are then join()ed by the newline character.

Created by Browserling

This binomial coefficients generator was created by me and my team at Browserling. Behind the scenes, it's actually powered by Browserling's programmer tools that are used by millions of people every month. Browserling itself is an online cross-browser testing service powered by alien technology. Check it out!

Secret message: If you love my tools, then I love you, too! Use coupon code COMLING to get a discount at my company Browserling.