Calculators
Lattice Path Calculator
Count exact shortest grid paths using only right and down moves with browser-only integer arithmetic.
Count shortest paths between opposite grid corners using only right and down moves. Enter 0 to 10000 steps in each direction. There are no diagonal moves or blocked points. Results stay in your browser.
How to count shortest lattice paths
A shortest path from (0, 0) to (r, d) uses exactly r right steps and d down steps. Choose which r of the r + d positions contain right moves: paths = C(r + d, r) = (r + d)! / (r! d!). The calculator evaluates this using an exact multiplicative binomial formula rather than floating-point factorials. Three right steps and three down steps give C(6, 3) = 20 paths. A grid with 3 by 3 cells therefore has 20 paths between opposite corners; a grid with 3 by 3 points needs only 2 steps each way and has 6 paths. If either step count is zero there is one straight path. With both counts zero there is one empty path. Swapping right and down counts leaves the result unchanged. This assumes a rectangular grid with no obstacles, no diagonal or backward moves, and no restriction relative to the diagonal. Use the Delannoy calculator when diagonal steps are allowed. Inputs accept whole numbers from 0 to 10000 per direction, with at most five decimal digits; surrounding whitespace and leading zeros are accepted. Signs, decimals, separators and scientific notation are rejected. Exact BigInt arithmetic preserves every digit, and all calculations stay in your browser.
Frequently Asked Questions
Everything you need to know about this tool, how it works, and privacy.
How many paths are there across a 3 by 3 cell grid?
There are 20 shortest paths: choose three right moves among six total moves. A 3 by 3 grid of points instead has 6 paths because each direction needs only two steps.
What formula counts the paths?
For r right moves and d down moves, the number is C(r + d, r). Every path corresponds to one ordering of those moves.
Are diagonal moves or obstacles included?
No. Only right and down moves on an unobstructed rectangular grid are allowed. The Delannoy calculator includes diagonal moves.
What happens when a step count is zero?
There is one straight path if one count is zero. With both counts zero, there is one empty path.
Are large results exact?
Yes. BigInt arithmetic preserves all digits for inputs from 0 to 10000 in each direction. Inputs remain in your browser.