Uniform Distribution Calculator
Every value equally likely — a flat density for the continuous case, equal bars for the discrete case. Pick a distribution, set the endpoints, and read off the probability, mean and variance.
About 33.33% of values fall between 3 and 5 — every value in [2, 8] is equally likely, so the density is flat at 1/6.
Calculation
Flat density — every value equally likely
The rectangle from 2 to 8 has height 1/6 = 0.1667. The shaded part is P(3 < X < 5) = 0.3333.
A uniform distribution calculator works out probabilities, quantiles, mean and variance for the uniform distribution — in both its forms, the continuous U(a, b) and the discrete uniform {a..b}. Enter the endpoints and read off the probability, with a flat-density chart that shows why the answer is what it is.
How to use the uniform distribution calculator
Use Continuous U(a, b) for measurements that can take any value in an interval, and Discrete {a..b} for whole-number outcomes such as a die roll.
- Choose a form: Continuous U(a, b) or Discrete {a..b}.
- Enter the endpoints a and b — any numbers for the continuous case, whole numbers for the discrete case.
- Pick what to find: a probability between two values, below or above a value, or a quantile (percentile).
- Read the headline probability, then check the results grid for the mean, variance, standard deviation and density, and the calculation ledger for every step. The chart shades the region your probability covers.
Try it now: with U(2, 8), the calculator gives P(3 < X < 5) = 0.3333, P(X > 7) = 0.1667, mean 5 and a 90th percentile of 7.4. Switch to Discrete {1..6} — a fair die — and it gives P(X = 4) = 0.1667, mean 3.5 and P(X ≤ 3) = 0.5.
What is a uniform distribution?
A uniform distribution is the 'no preference' distribution: every value in its range is equally likely. For the continuous uniform U(a, b), the density is flat — f(x) = 1/(b − a) for a ≤ x ≤ b, and 0 outside. For the discrete uniform on {a, a+1, ..., b}, each of the n = b − a + 1 values has probability 1/n. The uniform distribution is the starting point for the types of probability distributions guide, and it is the opposite of the normal distribution, which piles its probability in the middle.
Continuous vs discrete uniform
Both forms give every value the same probability, but they differ in what a 'value' is. The table sums up the two forms side by side.
| Continuous U(a, b) | Discrete {a..b} | |
|---|---|---|
| Values | Any real number in [a, b] | Whole numbers a, a+1, ..., b |
| Probability of one value | P(X = x) = 0 | P(X = k) = 1/n |
| Density / mass | f(x) = 1/(b − a), flat | P(X = k) = 1/n, equal bars |
| Mean | (a + b) / 2 | (a + b) / 2 |
| Variance | (b − a)2 / 12 | (n2 − 1) / 12 |
| Example | A bus arriving at a random time in [0, 10] minutes | A fair die {1..6} |
The flat density
The chart is a rectangle because the density is constant. The area of the rectangle is 1 — total probability — and the area of any slice is the probability of that interval. That is why P(3 < X < 5) for U(2, 8) is just the width of the slice (2) divided by the width of the whole rectangle (6): 2/6 = 0.3333. No integration needed — it is a rectangle.
Formulas at a glance
| Quantity | Continuous U(2, 8) | Discrete {1..6} |
|---|---|---|
| Density / PMF | 1/6 = 0.1667 | 1/6 = 0.1667 |
| Mean | 5 | 3.5 |
| Variance | 3 | 2.9167 |
| SD | 1.7321 | 1.7078 |
| 90th percentile | 7.4 | 6 |
Worked examples
Example 1 — continuous U(2, 8)
A spinner lands at a random point on a scale from 2 to 8. What is the chance it lands between 3 and 5? The density is f(x) = 1/(8 − 2) = 1/6 = 0.1667. P(3 < X < 5) = (5 − 3)/6 = 2/6 = 0.3333. P(X > 7) = (8 − 7)/6 = 1/6 = 0.1667. The mean is (2 + 8)/2 = 5, the variance is 36/12 = 3, the SD is √3 = 1.7321, and the 90th percentile is 2 + 0.9 × 6 = 7.4. And P(X = 4) = 0 — the spinner lands exactly on 4 with probability zero, because 4 is a single point.
Example 2 — a fair die
Roll a fair die, X = {1..6}. Each face has probability 1/6 = 0.1667, so P(X = 4) = 0.1667. The mean is (1 + 6)/2 = 3.5 and the variance is (36 − 1)/12 = 35/12 = 2.9167, so the SD is 1.7078. P(X ≤ 3) = 3/6 = 0.5 — half the faces are 3 or below. This is the same mean and variance as the single-die example on the expected value calculator page, which is a good cross-check.
Edge cases
- U(0, 10): P(2 < X < 7) = 5/10 = 0.5, and the 25th percentile is 0 + 0.25 × 10 = 2.5.
- a = b: the calculator shows an error. A degenerate interval has no spread — there is no distribution, just a single point.
- P(X = x) = 0 in the continuous case, always. If you need the chance of landing on an exact value, use a discrete distribution — or an interval around it.
- Discrete with a non-integer k: the calculator treats P(X = 4.5) as 0, because a die never shows 4.5. The cumulative probabilities still work, counting only whole values.
- The uniform distribution is symmetric, so its mean and median are the same — (a + b)/2. That is the opposite of the exponential distribution, which is always right-skewed.
Frequently asked questions
Why is P(X = 4) zero?
Because X is continuous. Probability is the area under the density curve, and a single point has no width, so its area is zero. Only intervals have positive probability. If you want the chance of being near 4, ask for an interval — for example P(3.9 < X < 4.1) for U(2, 8) is 0.2/6 = 0.0333. The discrete uniform is different: P(X = 4) = 1/6 for a fair die.
Continuous vs discrete uniform?
Both give every value the same probability, but they differ in what a 'value' is. The continuous uniform U(a, b) can take any real number between a and b, its density is the flat 1/(b − a), and P(X = x) = 0 for any single x. The discrete uniform on {a..b} takes only whole numbers, each with probability 1/n, and P(X = k) = 1/n. Use the continuous form for measurements (times, lengths) and the discrete form for counts (die rolls, card draws).
The uniform distribution on this page is the standard continuous and discrete uniform distribution. All worked examples on this page were recomputed with Python (scipy.stats). Last updated 19 November 2026.
See all 91 free statistics tools.
Next steps
More Tools to Explore
Keep going with the calculators that pair with the uniform distribution — the normal and exponential distributions, expected value and z-scores.
Normal Distribution Calculator
Find normal probabilities, quantiles and the bell curve.
Exponential Distribution Calculator
Find exponential probabilities, quantiles and the mean, median and variance.
Expected Value Calculator
Find the expected value, variance and standard deviation of a discrete random variable.
Poisson Distribution Calculator
Count events in a fixed time — the discrete partner of the exponential.
Z-Score Calculator
Turn any raw score into a z-score and read off its percentile in seconds.
Standard Deviation Calculator
Find the standard deviation and variance of any data set.
Explore All Tools →
Browse all 91 free statistics tools — every calculator on this site in one place.