P-Hat Calculator

Compute the sample proportion p̂ = x / n from your data, along with its standard error and a 95% confidence interval.

Quick Facts

Formula
p̂ = x / n
The sample proportion: successes divided by sample size. Standard error = √(p̂(1−p̂)/n).

Your Results

Calculated
Sample proportion (p̂)
-
x divided by n
As a percentage
-
p̂ × 100%
Standard error
-
√(p̂(1−p̂)/n)
95% confidence interval
-
p̂ ± 1.96 × SE

Ready

Enter the number of successes and the sample size, then calculate.

What is p-hat?

P-hat, written , is the sample proportion — the fraction of a sample that has some characteristic of interest. It is calculated by dividing the number of successes (x) by the total sample size (n):

p̂ = x / n

A "success" is simply the outcome you are counting: a voter who supports a candidate, a manufactured part that passes inspection, a patient who responds to treatment. P-hat is the best single-number estimate of the unknown true population proportion p. Because it comes from a sample rather than the whole population, p̂ is subject to sampling error, which is why we also report its standard error and a confidence interval.

Worked example

Suppose you survey 200 registered voters and 42 of them support a ballot measure. Then x = 42 and n = 200, so:

  • p̂ = 42 / 200 = 0.21, or 21%.
  • Standard error: SE = √(0.21 × 0.79 / 200) = √0.0008295 ≈ 0.0288.
  • 95% confidence interval: 0.21 ± 1.96 × 0.0288 = 0.21 ± 0.0564, i.e. about 0.154 to 0.266 (15.4% to 26.6%).

Standard error and confidence interval

The standard error measures how much p̂ would typically vary from sample to sample. For a proportion it is:

SE = √( p̂ (1 − p̂) / n )

A 95% confidence interval uses the normal approximation, p̂ ± 1.96 × SE, where 1.96 is the z-value cutting off the central 95% of a standard normal distribution. Roughly speaking, if you repeated the sampling many times, about 95% of such intervals would contain the true proportion p. Notice that SE shrinks in proportion to 1/√n — to halve the margin of error you must quadruple the sample size.

Common reference points

  • The standard error is largest when p̂ = 0.5, because p̂(1 − p̂) is maximized at 0.25. Estimates near 50/50 are the hardest to pin down.
  • For a 95% interval with a ±5% margin near p̂ = 0.5, you need roughly n ≈ 385 (this is why many national polls use ~1,000 respondents for a ±3% margin).
  • The normal approximation is generally considered valid when both n·p̂ ≥ 10 and n·(1 − p̂) ≥ 10.

Frequently Asked Questions

What is the difference between p and p-hat?
p (without the hat) is the true proportion in the entire population — usually unknown. is the estimate of p computed from a sample. As the sample size grows, p̂ tends to get closer to p, but for any finite sample they will generally differ by some amount described by the standard error.
Can p-hat be greater than 1 or negative?
No. Because p̂ = x / n and x can range only from 0 to n, p̂ always falls between 0 and 1 (equivalently 0% to 100%). If a calculation gives a value outside that range, either x exceeds n or a number was entered incorrectly.
How large should my sample be?
It depends on the margin of error you can tolerate. For a 95% confidence interval with a ±5% margin near p̂ = 0.5, you need about n ≈ 385; for ±3% you need roughly n ≈ 1,067. Smaller samples still give a valid p̂, but the confidence interval widens, so interpret the estimate cautiously.