UART baud rate calculator
Work out the divisor for a baud rate, the rate your clock actually produces, and whether the error is small enough to work.
Values
Common rates at this clock
| Baud | Divisor | Actual | Error |
|---|
Results
- Divisor
- Actual baud rate
- Error
How it's calculated
The UART divides its clock by the oversampling factor and a divisor, which is rounded to the nearest step the hardware supports:
N = fclk / (oversampling × baud)
actual baud = fclk / (oversampling × N)
Registers often hold a value derived from N, not N itself. On an AVR, UBRR holds N − 1.
A receiver finds the falling edge of the start bit, then samples each bit where it expects the middle to be. With 8N1 frames the stop bit is sampled 9.5 bit times after that edge, so every 1% of rate mismatch moves that sample about a tenth of a bit. If it drifts close to half a bit, the receiver reads the wrong bit and reports a framing error.
Both ends contribute: what matters is the difference between the two clocks. A common rule is to keep each side within 2%, which leaves room for the other side's error. The trace shows this side sending to a receiver with an exact clock.