Resources · Checked 9 October 2026
3.3 V to 5 V level shifting: which method, and when you need one
ESP32 with an Arduino UNO, WS2812B LEDs and 5 V I²C, from the data sheets
By Bulan Sarkar, founder of ElectronicsInfoline (since 2000), Durgapur · Every threshold from the maker's data sheet, 9 October 2026 · About a 10-minute read
This page is for joining a 3.3 V board to 5 V parts. The ESP32 is the worked example; the method is the same for any 3.3 V chip once you have its data sheet open.
Two questions decide it. Will the 5 V part read the ESP32's HIGH as a HIGH? And will the 5 V part's HIGH harm the ESP32? They have different answers and different fixes.
5 V into an ESP32 needs shifting, always. Its inputs are rated to 3.6 V. For a one-way signal (UART from an UNO, a 5 V sensor output) a 10 kΩ / 18 kΩ divider does it.
3.3 V into 5 V parts is sometimes fine. The ESP32 guarantees only 2.64 V as a HIGH. A 74AHCT125 input needs 2.0 V, so that works. An UNO pin needs 3.0 V and a WS2812B needs 3.5 V, so those are not guaranteed.
The fixes: a BSS138 shifter for I²C, a 74AHCT125 for LED strips and other fast one-way signals, and a TXS0108E only for short, lightly loaded lines on a board.
3.3 V into a 5 V input: compare two numbers
Every digital input has a VIH: the lowest voltage it promises to read as HIGH. Every output has a VOH: the lowest voltage it promises to put out as HIGH. If VOH is at or above VIH, the link works by guarantee.
The ESP32 data sheet gives VOH as 0.8 × VDD, so 2.64 V at 3.3 V. It will usually be higher on a lightly loaded pin, but 2.64 V is the number it stands behind. Figure 1 sets it against four common 5 V inputs.
- 74AHCT125 input: needs 2.0 V; margin 0.64 V. This is what TTL-level inputs are for.
- UNO pin (ATmega328P at 5 V): needs 0.6 × 5 = 3.0 V; short by 0.36 V. ESP32 → UNO serial often works on the bench. It is not guaranteed.
- UNO I²C pins (A4, A5): need 0.7 × 5 = 3.5 V. Short by 0.86 V, and on I²C the pull-ups set the HIGH, so where you tie them matters too.
- WS2812B data in: needs 0.7 × 5 = 3.5 V. Short by 0.86 V. That gap is enough for a strip to work on one ESP32 and flicker on another.
Our take: "it works on my desk" is a typical part on a cool day. Design to the minimum and the maximum, and it works on every board you build.
5 V into an ESP32: never direct
The other way round is a rating, not a margin. The ESP32 data sheet allows an input up to VDD + 0.3 V, which is 3.6 V. A 5 V HIGH is 1.4 V over that. It is outside what Espressif promises, so it does not go on a board we build.
One way down: the resistor divider
For a signal that only travels 5 V → 3.3 V (an UNO's TX into the ESP32's RX, a 5 V sensor's digital output), two resistors are the whole fix. The ratio has to satisfy both ends of the ESP32's input window:
- The weakest 5 V HIGH must still read HIGH. An UNO pin guarantees 4.2 V at 20 mA, and the ESP32 needs 2.47 V, so the ratio must be at least 0.589.
- The strongest 5 V HIGH must stay under 3.6 V. Allowing for a rail at 5.25 V, the ratio must be at most 0.686.
10 kΩ on top and 18 kΩ to ground gives 0.643, inside both, from the common E12 values. The pin sees 3.21 V from a 5.00 V HIGH, 3.38 V from 5.25 V, and 2.70 V from the weakest 4.2 V.
Speed is fine for serial. The ESP32 pin sees 6.4 kΩ (the two resistors in parallel) charging about 12 pF of pin and jumper, a 10–90 % rise of about 170 ns. One bit at 115,200 baud lasts 8.7 µs. The divider draws 0.18 mA from the 5 V pin while it is HIGH.
Our take: for anything that only flows 5 V → 3.3 V and is slower than about a megabit, two resistors do the job without a module.
Both ways, open-drain: the BSS138 shifter for I²C
I²C lines are pulled up by resistors and pulled down by whichever device is talking, from either side. Philips published the fix in 1997 (AN97055): one n-channel MOSFET per line, gate tied to the low supply, source on the 3.3 V side, drain on the 5 V side, a pull-up on each side.
When nobody pulls, the MOSFET is off and each side rests at its own supply. When the 3.3 V side pulls low, the gate-source voltage rises and the MOSFET drags the 5 V side down with it. When the 5 V side pulls low, the MOSFET's body diode pulls the source low until the channel turns on.
The application note asks for a threshold about 1.0 V below the low supply. The BSS138 (Nexperia BSS138BK) has 0.5 V to 1.6 V, well under 2.3 V, and it is the MOSFET most four-channel shifter modules carry.
Speed comes from the pull-ups. Most modules fit 10 kΩ. With 50 pF of breadboard wiring that gives a 30–70 % rise of about 0.42 µs. At 100 kHz a bit lasts 10 µs, so that is nothing. At 400 kHz a bit is 2.5 µs and the rise eats a sixth of it; 4.7 kΩ brings it to 0.20 µs.
Our take: for I²C between an ESP32 and a 5 V sensor or an UNO, a BSS138 module, and check the module's pull-ups before you add more of your own.
Fast and one way up: the 74AHCT125 for LED strips
A WS2812B wants 3.5 V at 800 kbps. A 74AHCT125 powered from 5 V takes the ESP32's 3.3 V signal (it needs only 2.0 V) and drives a full 5 V edge into the strip. TI guarantees at least 3.8 V at 8 mA, even on a 4.5 V supply.
It is one-way and push-pull, which is what an LED data line, a 5 V shift register or a servo signal needs. One chip carries four signals.
Our take: for any LED strip on a 3.3 V board, a 74AHCT125 at the strip end. It removes the margin problem at the strip input.
The TXS0108E module, and its catch
The eight-channel shifter boards carry a TXS0108E: two-way, no direction pin, rated to 110 Mbps push-pull and 1.2 Mbps open-drain. It looks like the universal answer. Its data sheet is more careful.
It holds a line high through internal pull-ups of 4 kΩ, and TI says its DC drive is "hundreds of micro-amperes". A fast one-shot about 30 ns long helps each edge along. So anything on the 5 V side that pulls down drags the HIGH with it. TI gives the equation: VOH = VCC × RPD ÷ (RPD + 4 kΩ).
Run it for a WS2812B: to keep 3.5 V from 5 V, the pull-down must be at least 9.3 kΩ. A 10 kΩ pull-down leaves 3.57 V, just; 4.7 kΩ leaves 2.70 V, and the strip fails.
Our take: a TXS0108E is fine for SPI or UART between two chips a few centimetres apart. For LED strips, long wires, relay modules or anything with a pull-down, use the 74AHCT125 or the BSS138 instead.
Choosing in one pass
Tips and checks
- Join the grounds first. A level shifter between two boards with no common ground shifts nothing.
- Put the 74AHCT125 near the strip, not near the ESP32. The 3.3 V run is then short, and the long run carries a full 5 V signal.
- Count the pull-ups. A BSS138 module, a sensor breakout and an UNO with pull-ups enabled can stack three in parallel on one line.
- Tie every unused 74AHCT125 input and its enable pin to ground. TI asks for unused inputs to be held at VCC or GND.
- Check the 5 V part's own data sheet. Some 5 V modules have TTL-level inputs and take 3.3 V without help; the VIH line tells you in one look.
- A divider works only one way. Do not put one on I²C or on a line that sometimes reads and sometimes writes.
What we'd do: ESP32 to an UNO by serial gets a divider on the UNO's TX and, to be sure, a 74AHCT125 gate on the ESP32's TX. ESP32 to a 5 V I²C sensor gets a BSS138 module. ESP32 to a WS2812B strip gets a 74AHCT125 at the strip. The TXS0108E stays for short buses between chips on one board. If a 3.3 V pin has to switch a load, that is a job for a MOSFET, not a level shifter: our MOSFET guide picks the part.
Questions we keep hearing
Are ESP32 pins 5 V tolerant? No. Espressif rates the inputs to VDD + 0.3 V, which is 3.6 V on a 3.3 V supply. Use a divider or a shifter for any 5 V signal.
Can an ESP32 drive WS2812B LEDs without a level shifter? Often, but not by guarantee. The WS2812B wants 0.7 × VDD, 3.5 V on 5 V, and the ESP32 guarantees 2.64 V. A 74AHCT125 closes the gap.
Can I connect ESP32 TX to Arduino UNO RX directly? It usually works but sits outside the guarantee: the UNO needs 3.0 V and the ESP32 promises 2.64 V. The other direction, UNO TX into the ESP32, needs a divider every time.
Lessons behind the numbers
- Logic levels: VIH, VOH and noise margin
- Logic families: why AHCT has TTL-level inputs
- Voltage divider: the ratio and the loading
- MOSFET: threshold and body diode, both used by the BSS138 shifter
- Reading IC data sheets: which rows bind
- LED circuits: the load at the end of the strip
Sources
Every data sheet read on 9 October 2026.
- Espressif, ESP32 Series Datasheet v5.3 (July 2026), Table 5-3 DC Characteristics (3.3 V, 25 °C), p. 52 (VIH 0.75 × VDD to VDD + 0.3 V; VIL max 0.25 × VDD; VOH min 0.8 × VDD; VOL max 0.1 × VDD; pin capacitance 2 pF)
- Microchip, ATmega48A/PA/88A/PA/168A/PA/328/P data sheet, DS40002061B (2020), Table 30-1 Common DC characteristics, pp. 322–323 (VIH min 0.6 × VCC (VCC 2.4 to 5.5 V); VOH min 4.2 V at −20 mA, VCC 5 V)
- Microchip, DS40002061B, Table 29-14 Two-wire Serial Bus Requirements, p. 317 (I²C input high voltage min 0.7 × VCC)
- Worldsemi, WS2812B data sheet (copy hosted by Adafruit), Electrical Characteristics (DIN input high level min 0.7 × VDD at VDD 4.5 to 5.5 V; data at 800 kbps)
- Texas Instruments, SN74AHCT125 data sheet, SCLS264R, revised February 2024, §5.2 and §5.4 (VCC 4.5 to 5.5 V; VIH min 2 V, VIL max 0.8 V; IOH −8 mA; VOH min 3.8 V at −8 mA and 4.5 V)
- Texas Instruments, TXS0108E data sheet, SCES642L, revised November 2024, §1, §7.3 and Equation 1 (110 Mbps push-pull, 1.2 Mbps open-drain; A port 1.4 to 3.6 V, B port 1.65 to 5.5 V; pull-ups 4 kΩ driving high, 40 kΩ driving low; DC source capability of hundreds of µA; one-shot about 30 ns; VOH = VCC × RPD ÷ (RPD + 4 kΩ))
- Philips Semiconductors, AN97055, Bi-directional level shifter for I²C-bus and other systems, 4 August 1997 (copy hosted by Adafruit) (one n-channel MOSFET per line, gate to the low supply; threshold about 1 V below the lowest low-side supply (max 2 V for a 3 V side))
- Nexperia, BSS138BK product data sheet, Rev. 1, 4 August 2011, §8 Characteristics (VGSth 0.48 min, 1.1 typ, 1.6 V max at 250 µA)
Our own choices, not from any source: the ESP32 at VDD = 3.3 V; a 5 V rail between 5.00 and 5.25 V; the 10 kΩ / 18 kΩ divider; 12 pF of pin and jumper capacitance (2 pF of it is the ESP32 pin); 50 pF of I²C wiring; and the 10 kΩ and 4.7 kΩ pull-up examples. The WS2812B and AN97055 documents are copies hosted by Adafruit.
How this page was checked
Every threshold comes from the maker's data sheet, read on 9 October 2026, and every margin, ratio and rise time is computed in code from those values. We print no prices and carry no affiliate links. Found an error? Tell us.
More guides: Resources · Which MOSFET for Arduino and ESP32 · Buying components in India