English tools / Electronics

UART baud rate error calculator

Enter the UART clock and baud rate to get the divisor to set, the real baud rate and the error, plus a table for the common baud rates.

Baud rate error

Wrong result or a typo? Send feedback

Where baud rate error comes from

A UART divides its clock to get the baud rate. With 16x oversampling, baud = clock ÷ (16 × divisor), and the divisor must be a whole number, so the real baud rate is often a little off. For 115200 baud from 16 MHz: 16,000,000 ÷ (16 × 115200) ≈ 8.68, the closest divisor is 9, and the real baud rate is 111,111, an error of −3.5%.

The calculator picks the closest divisor and gives the error as (real − target) ÷ target.

How much error is too much?

The receiver samples each bit in the middle. An 8N1 frame has 10 bits, and by the stop bit the sampling point may not drift more than half a bit, so the two ends together must be within about 5%. After allowing for sampling resolution and slow signal edges, a common rule is to keep each end within ±2%. The calculator rates under 1% as fine, 1% to 2% as usually working, and over 2% as likely to give garbled data.

Baud rate crystals

These frequencies are whole multiples of 1.8432 MHz (115200 × 16), so all the common baud rates come out with 0% error.

ClockDivisor for 115200 (16x)
1.8432 MHz1
3.6864 MHz2
7.3728 MHz4
11.0592 MHz6
14.7456 MHz8
18.432 MHz10

Connecting 5 V and 3.3 V UARTs

Wiring the TX of a 5 V board (such as an Arduino Uno) straight to the RX of a 3.3 V board (such as an ESP32 or Raspberry Pi) can damage the 3.3 V side. A simple fix is a voltage divider in between: with R1 = 1 kΩ and R2 = 2 kΩ, RX sees 5 × 2 ÷ (1 + 2) ≈ 3.33 V. Use the voltage divider calculator for other values.

5 V device RX TX GND 3.3 V device TX RX GND R1 1 kΩ R2 2 kΩ

The other direction (3.3 V TX to 5 V RX) usually works without parts, since many 5 V chips read about 3 V as high, but check VIH in the 5 V chip’s datasheet; if it isn’t enough, use a level shifter. Always connect the two grounds.

Frequently asked questions

Why does an Arduino Uno at 16 MHz work at 115200?

At 115200 the Arduino core uses 8x oversampling (U2X=1), which is +2.1% off. The ATmega16U2 that does USB-to-serial on the Uno also runs at 16 MHz with the same error, so the two ends match. Against an accurate USB-UART chip or another device it can fail; 57600 or lower, or rates that divide evenly such as 250000, 500000 and 1000000, are safer.

How do I set the STM32 BRR?

With 16x oversampling (OVER8=0), BRR = clock ÷ baud, rounded to a whole number; the fraction is already in the low 4 bits. For 72 MHz and 115200: 72,000,000 ÷ 115200 = 625 = 0x271. Use the clock of the bus the USART is on (APB1 or APB2). With 8x oversampling (OVER8=1) BRR is encoded differently, and this calculator doesn’t cover it.

What is UBRR on AVR?

AVR’s UBRR register takes the divisor minus 1. In the 16x and 8x modes the calculator shows the UBRR value next to the divisor.