I2C pull-up resistor calculator

I2C needs a pull-up resistor on SDA and one on SCL. Too small and the chips cannot pull the lines low; too big and the lines rise too slowly. Enter the speed, the voltage and the bus capacitance to get the range that works.

Smallest allowed
—
Largest allowed
—
Suggested standard value (rise time)
—

A suggestion: any standard value inside the range meets the specification.

Rise time with your resistor
—
Limit for this speed
—
Verdict
—

Results are arithmetic on published formulas, not measurements. Check them on your hardware. Free, no sign-up

What is a pull-up resistor?

I2C chips never drive SDA and SCL high. Their outputs are open-drain: they can only connect the line to ground, or let go of it. A pull-up resistor to the supply brings the line back up whenever no chip is holding it low. Every I2C bus needs one on SDA and one on SCL.

Why there is a minimum and a maximum

Minimum: when a chip pulls the line low, current flows through the pull-up into that chip. The specification only guarantees that a chip can sink 3 mA while keeping the line at 0.4 V or less (20 mA in Fast-mode Plus), so a smaller resistor would ask for more current than the chip can take.

Maximum: every wire and every chip pin adds capacitance, and the resistor has to charge it. The line must rise from 30 % to 70 % of VDD within the rise time the speed allows: 1000 ns at 100 kHz, 300 ns at 400 kHz, 120 ns at 1 MHz.

Estimating the bus capacitance

Each chip pin adds up to 10 pF (the limit in the specification) and wiring adds more: short breadboard wires a few tens of picofarads, a metre of cable often around 100 pF. For a small hobby setup, 50 to 200 pF is a reasonable guess. The specification allows at most 400 pF (550 pF in Fast-mode Plus).

Pull-ups that are already there

Many breakout boards (BME280 sensors, SSD1306 displays, MPU6050 modules) already carry pull-ups, often 4.7 kΩ or 10 kΩ. Several modules on one bus put their pull-ups in parallel: two 4.7 kΩ make about 2.35 kΩ. Check the result against the smallest allowed value.

The formula

Rp(min) = (VDD − VOL(max)) / IOL     VOL(max) = 0.4 V, IOL = 3 mA (20 mA in Fast-mode Plus)
Rp(max) = tr / (0.8473 × Cb)         tr = 1000 ns, 300 ns or 120 ns; Cb = bus capacitance
tr      = 0.8473 × Rp × Cb          0.8473 = ln(0.7 / 0.3): the time to rise from 30 % to 70 % of VDD

Source: NXP UM10204, I2C-bus specification and user manual, section 7.1 “Pull-up resistor sizing” and table 10 (rise time limits).

Worked example

An ESP32 at 3.3 V with a sensor and a display on short wires, about 100 pF, at 400 kHz: Rp(min) = (3.3 − 0.4) V / 3 mA = 967 Ω, Rp(max) = 300 ns / (0.8473 × 100 pF) = 3.54 kΩ. The calculator suggests 1.8 kΩ (rise time 153 ns).

A 10 kΩ pull-up would give a 847 ns rise time: too slow for 400 kHz, but fine at 100 kHz, where up to 11.8 kΩ is allowed.

Questions and answers

Is 4.7 kΩ always right for I2C?

It is a common choice for 100 kHz at 3.3 V or 5 V with short wires, and there it usually works. At 400 kHz, or with long wires and many devices, it can be too weak: check it against the largest allowed value for your bus.

Do I need pull-ups if my module already has them?

Usually not. Most breakout boards include pull-ups on SDA and SCL. Check the module’s schematic, or measure the resistance between SDA and VCC with the power off. With many modules on one bus, their pull-ups add up in parallel and can become too strong.

Can I use the microcontroller’s internal pull-ups?

Only for short, slow buses. Internal pull-ups are weak, typically 20 to 80 kΩ depending on the chip, so the lines rise slowly. They can do for a quick test at 100 kHz with one sensor on short wires; use external resistors for anything else.

What happens if the pull-up is wrong?

Too strong (too small) and a chip cannot pull the line low enough, so bits are misread. Too weak (too large) and the edges become slow ramps; at higher speeds the bits blur, devices stop answering or the bus hangs. Both can look like a “device not found” error.

Should I pull up to 3.3 V or 5 V?

To the supply of the chips on the bus. If a 3.3 V board such as an ESP32 or a Raspberry Pi Pico is on the bus, pull up to 3.3 V: pulling its pins up to 5 V can damage it. To mix 3.3 V and 5 V devices, use an I2C level shifter.

Learn the background

Free lessons of the BoardPilot course that explain the ideas behind this calculator:

Other calculators

See it on a real board

BoardPilot uses these same calculations inside the app, next to a live 3D view of your board, its pins and wires, with guided debugging when something does not work. Try it in your browser, or download it for macOS and Windows.