Pi Calculator Tool
Calculate π to arbitrary decimal precision in your browser with Web Workers, digit limits, and consecutive digit detection.
Pi Calculator
A high-precision π (pi) calculator that runs entirely in your browser. Compute thousands or millions of decimal places of π using the Rabinowitz–Wagon spigot algorithm, with optional multi-threaded acceleration via Web Workers.
Key Features
Flexible Stop Conditions
- Target Digits: Stop when a specified number of decimal places is reached
- Consecutive Digits: Stop when N consecutive identical digits appear (e.g., six 9s in a row)
- Either Condition: Stop when either condition is met first
Real-time Display
- Live π value updated during computation
- Progress tracking with digit count and elapsed time
- Retains the most precise result across all sessions
Multi-threaded Computation
- Optional parallel computation using Web Workers
- Automatically detects available CPU cores
- Uses Machin formula term splitting for faster bulk digit generation
Privacy
- All computation happens locally in your browser
- No data is sent to any server
- Results are stored in local storage only
Use Cases
- Mathematics education and exploration
- Testing browser computational limits
- Searching for interesting digit patterns in π
- Benchmarking device performance
Getting Started
- Open the Pi Calculator tool
- Choose a stop condition (target digits or consecutive digits)
- Optionally enable multi-threaded mode for faster computation
- Click Start Calculation and watch π unfold digit by digit
Algorithm
The primary algorithm is the Rabinowitz–Wagon spigot algorithm, which generates π digits one at a time without requiring the previous digits to be stored. For multi-threaded mode, the Machin formula is used with parallel term summation:
$$\frac{\pi}{4} = 4 \arctan\frac{1}{5} - \arctan\frac{1}{239}$$