UART baud rate error calculator
Every standard baud rate at your clock, with the integer divisor the UART will actually load and the error that results. Pick a crystal before you pick a rate.
The clock that actually reaches the UART, after the PLL and any peripheral prescaler — not the crystal on the board. This is the field people get wrong.
Which row the frame diagram above draws. It changes the picture only; every rate in the table is calculated regardless.
16× samples each bit sixteen times and votes on the middle three, which is what buys the ±2–3 % tolerance. 8× doubles the reachable baud rate and halves that margin.
Integer-only dividers round hard, so the error jumps around with the clock. A fractional divider gets much closer, which is why an odd crystal can still hit 115200 on an STM32.
Adds a non-standard rate to the table — 31250 for MIDI, 250000 for DMX, or whatever the other end of the link insists on.
| Baud | Divisor | Actual | Error | Usable |
|---|---|---|---|---|
| 1200 | 833 | 1200 | 0.04 % | pass |
| 2400 | 417 | 2398 | -0.08 % | pass |
| 4800 | 208 | 4808 | 0.16 % | pass |
| 9600 | 104 | 9615 | 0.16 % | pass |
| 19200 | 52 | 19231 | 0.16 % | pass |
| 38400 | 26 | 38462 | 0.16 % | pass |
| 57600 | 17 | 58824 | 2.12 % | FAIL |
| 115200 | 9 | 111111 | -3.55 % | FAIL |
| 230400 | 4 | 250000 | 8.51 % | FAIL |
| 460800 | 2 | 500000 | 8.51 % | FAIL |
| 921600 | 1 | 1000000 | 8.51 % | FAIL |
How this is calculated
Standard: UART baud generators, integer and fractional divisor (AVR, STM32, PIC, SAMD and similar)
- A fractional generator rounds the divisor to the nearest 1/2ⁿ instead of to a whole number, where n = 4 for the STM32 USART BRR and for SAMD SERCOM.
Assumptions
- Register width taken as 16 bits, which the fraction bits share on a fractional generator — the STM32 BRR is a 12.4 fixed-point value.
- Receiver tolerance taken as ±2 %, the common rule of thumb.
- Error budget is one-sided: it ignores the far end’s own error.
- No allowance for crystal tolerance or drift over temperature.
- Internal RC oscillators are far worse than this figure suggests.
What sets UART baud rate error
A classic UART does not generate the baud rate directly. It divides the peripheral clock by an integer to get a sampling clock that runs at 16× (or 8×) the bit rate, then counts 16 samples per bit and reads the middle ones. The divisor has to be an integer, so most clock and baud rate combinations cannot be hit exactly. This is the calculation from any 8250/16550-style datasheet, and from the AVR (ATmega328 datasheet section 19.3), STM32 (RM0008 section 27.3.4) and PIC USART chapters — the divisor, actual rate and error expressions under How this is calculated above.
Register conventions differ. AVR loads UBRR = divisor − 1; 16550 and most PICs load the divisor itself. The tool shows the divisor; subtract one for UBRR. It also checks the divisor against 16 bits, because at low rates on a fast clock it will not fit even when the error is zero.
Usable is defined as |error| ≤ 2 %. That is not a UART specification, it is a budget, and the next section says where it comes from.
Baud rate error chart
The error for the common clocks against the common rates, computed by the calculator above for an integer divisor at 16× oversampling, which is what an AVR or a classic 16550 has and the fallback every fractional generator degrades to. The crystal frequencies that look odd, 11.0592 MHz, 14.7456 MHz and 18.432 MHz, are odd on purpose: they are exact multiples of 16 × 115 200, and the zeros all the way to 230 400 are why they exist.
| Clock | 9600 | 19200 | 38400 | 57600 | 115200 | 230400 | 921600 |
|---|---|---|---|---|---|---|---|
| 8 MHz | +0.16 % | +0.16 % | +0.16 % | −3.55 % ✗ | +8.51 % ✗ | +8.51 % ✗ | −45.75 % ✗ |
| 11.0592 MHz | 0 | 0 | 0 | 0 | 0 | 0 | −25.00 % ✗ |
| 12 MHz | +0.16 % | +0.16 % | −2.34 % ✗ | +0.16 % | −6.99 % ✗ | +8.51 % ✗ | −18.62 % ✗ |
| 14.7456 MHz | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 16 MHz | +0.16 % | +0.16 % | +0.16 % | +2.12 % ✗ | −3.55 % ✗ | +8.51 % ✗ | +8.51 % ✗ |
| 18.432 MHz | 0 | 0 | 0 | 0 | 0 | 0 | +25.00 % ✗ |
| 24 MHz | +0.16 % | +0.16 % | +0.16 % | +0.16 % | +0.16 % | −6.99 % ✗ | −18.62 % ✗ |
| 48 MHz | −0.16 % | +0.16 % | +0.16 % | +0.16 % | +0.16 % | +0.16 % | +8.51 % ✗ |
| 72 MHz | −0.05 % | +0.16 % | +0.16 % | +0.16 % | +0.16 % | −2.34 % ✗ | −2.34 % ✗ |
Worked example: 115200 baud on a 16 MHz AVR
ATmega328 on the stock 16 MHz crystal, 115200 baud, normal (16×) mode.
ideal = 16 000 000 / (16 × 115 200) = 8.681
divisor = 9 (UBRR = 8)
actual = 16 000 000 / (16 × 9) = 111 111 baud
error = (111 111 − 115 200) / 115 200 = −3.55 % → FAILThe tool gives divisor 9, actual 111111, −3.55 %, FAIL. The AVR datasheet table says the same thing in its "−3.5 %" column. Switch to double-speed (U2X, 8× sampling):
ideal = 16 000 000 / (8 × 115 200) = 17.36
divisor = 17 (UBRR = 16)
actual = 16 000 000 / (8 × 17) = 117 647 baud
error = +2.12 % → still FAIL at the 2 % lineThe Arduino core uses this U2X setting. It works against a PC because the USB bridge on the far end has almost zero error of its own; against a second 16 MHz AVR at normal speed it is 5.7 % relative and fails.
Now why the budget is about 2 %.
frame = start + 8 data + stop = 10 bits
receiver samples at the middle of each bit, resynchronised only at the start edge
drift at the last bit = 10 × error (error accumulates, no resync mid-frame)
half a bit of margin = 50 % / 10 = 5 % if the sampler were perfect
16× sampler quantisation costs ~1/16 = 6 % of a bit, majority vote a bit more
practical one-end limit ≈ ±3 %; shared between transmitter and receiver ≈ ±2 % eachSo −3.55 % at one end is at the edge even against a perfect partner; add a crystal at ±50 ppm and an RC oscillator at ±1 % and it is gone. That is the whole reason 115200 on a 16 MHz AVR is unreliable, and why 9600 (divisor 104, +0.16 %) never is.
Same rate on a serial-friendly crystal:
11.0592 MHz: 11 059 200 / (16 × 115 200) = 6 exact
7.3728 MHz: 7 372 800 / (16 × 115 200) = 4 exact
14.7456 MHz: 14 745 600 / (16 × 921 600) = 1 exact, every standard rate below it tooThese frequencies are integer multiples of 115200 × 16 = 1.8432 MHz. Pick one of them and the whole table reads 0.00 %.
Where the baud rate budget stops being valid
- Exotic register layouts. The fraction settings above cover the common 1/8 and 1/16 generators — the STM32 BRR case, 72 MHz / (16 × 115200) = 39.0625, loads as mantissa 39, fraction 1 and the tool reports it exact, with the integer setting (39, +0.16 %) as the pessimistic comparison. But vendors differ in how the register is carved up, so check the reference manual before trusting a marginal result on an unfamiliar part. USB bridges (FT232, CP210x) are under 0.1 % at every common rate and need no calculation at all.
- Clock accuracy is not included. A crystal contributes ±20 to ±100 ppm, negligible. An internal RC oscillator is ±1 % factory calibrated and ±10 % untrimmed. Add it to the figure shown. Auto-baud or a crystal is mandatory for anything above 38400 on an RC clock. Thecrystal ppm calculator stacks tolerance, load pull, temperature and ageing into the number to add here.
- The two-sided budget. The pass/fail column is one end. Both ends contribute, and their signs add in the worst case. If you control both ends, aim for ±1 % each.
Common UART baud rate mistakes
- Loading the divisor into UBRR without subtracting one. Off by one at divisor 9 is an 11 % error; at divisor 104 it is 1 %, which is why the bug only shows up at high rates.
- Picking 8 MHz or 16 MHz because it makes the millisecond timer neat, then finding 115200 does not work. If the board talks serial as its main job, the crystal should be 11.0592, 14.7456 or 18.432 MHz, and the timer can live with a slightly odd reload value.
- Testing against a PC and concluding the rate is fine. USB bridges have near-zero error and generous receivers; a second MCU with the same −3.5 % in the opposite direction will not talk to it.
- Reading double-speed mode as "better". U2X halves the divisor step so it sometimes lands closer, but the 8× sampler has half the timing margin.
- Ignoring the register width. A 200 MHz peripheral clock at 110 baud needs divisor 113636, which does not fit in 16 bits. The dagger in the table is that case.
- Forgetting the peripheral clock is not the core clock. On STM32 the USARTs sit on APB1 or APB2, which are often divided from SYSCLK. Enter the bus clock, not the PLL output.
Further reading
- ATmega328P datasheet, USART chapter— the UBRR formula and the error tables for common crystals, the source of the −3.5 % figure.
- STM32F1 reference manual RM0008, USART baud rate generation— how the fractional BRR register works and its own error table.
- Maxim tutorial 2141, "Determining clock accuracy requirements for UART communications"— the bit-by-bit drift analysis behind the 2–3 % rule.