ElectronicsInfoline

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 input2.0 VATmega328P pin3.0 VATmega328P I²C pins (A4, A5)3.5 VWS2812B data in3.5 VESP32 HIGH, min 2.64 V012345volts needed to read HIGH
Figure 1. The lowest voltage each 5 V input reads as HIGH, against the ESP32's guaranteed HIGH of 2.64 V. Green clears it; red does not.
  • 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.

5 V outputUNO TX, sensor10 kΩESP32input pin18 kΩ3.21 Vone direction only: 5 V side to 3.3 V side
Figure 2. The divider: 10 kΩ from the 5 V output, 18 kΩ to ground, the ESP32 pin at the junction. It passes signals one way only.
reads HIGH safelyover the limit2.70 V3.21 V3.38 V2.02.53.03.54.02.47 V min3.6 V maxvolts at the pin
Figure 3. Where the divider lands in the ESP32's input window: from the weakest guaranteed UNO HIGH (4.2 V), from 5.00 V and from 5.25 V. All three sit between 2.47 V and 3.6 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.

3.3 V side5 V side3.3 V5 V10 kΩ10 kΩBSS138SDGSDA or SCLSDA or SCLeither side can pull the line low; both pull-ups lift it
Figure 4. The AN97055 shifter, one per line: gate to 3.3 V, source to the 3.3 V side, drain to the 5 V side, a 10 kΩ pull-up each side.

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.

ESP32 pin3.3 V logic1A1OE to GNDVCC 5 V5 V logic74AHCT125WS2812BDINtie the three unused inputs and their OE pins to ground
Figure 5. ESP32 pin into one gate of a 74AHCT125 powered from 5 V, output to the strip's DIN. The gate's enable pin goes to ground so the gate is always on.

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.

WS2812B needs 3.5 V9.3 kΩ0123451 kΩ10 kΩ100 kΩpull-down on the 5 V sideHIGH level, V
Figure 6. TXS0108E HIGH level on the 5 V side against an external pull-down, from TI's Equation 1. Below 9.3 kΩ it falls under the 3.5 V a WS2812B needs.

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

5 V → ESP32 only?yes10 kΩ / 18 kΩ dividernoI²C, both ways?yesBSS138 shifternoESP32 → strip, fast?yes74AHCT125 buffernoShort bus, both ways?yesTXS0108E, short traces
Figure 7. The order we ask the questions in, for a 3.3 V board meeting a 5 V part.

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.

Why does my TXS0108E level shifter not work? Usually a load it cannot drive. Its pull-ups are 4 kΩ and its DC drive is a few hundred micro-amps, so a pull-down, an LED or a long cable pulls the HIGH down. Use a 74AHCT125 for one-way signals and a BSS138 for I²C.

What resistor values for a 5 V to 3.3 V divider? 10 kΩ on top and 18 kΩ to ground. It gives 3.21 V from 5 V, stays under 3.6 V up to 5.25 V, and still reads HIGH from a weak 4.2 V.

Lessons behind the numbers

Also: voltage divider calculator · 15 Arduino projects.

Sources

Every data sheet read on 9 October 2026.

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