
A voltage divider is one of the first circuits every maker learns, and one of the most useful. With just two resistors you can bring a 5 V signal down to a safe 3.3 V for an ESP32 or Raspberry Pi, or measure a 12 V battery with a 3.3 V analog input. Here is how it works and how to pick the resistors.
The Voltage Divider Formula
Connect R1 from the input voltage to a middle point, and R2 from that middle point to ground. The voltage at the middle point is:
Vout = Vin × R2 / (R1 + R2)
It comes straight from Ohm’s law: the same current flows through both resistors, so each one takes a share of the voltage proportional to its resistance.
🛒 What you need
As an Amazon Associate, Arelvox earns from qualifying purchases. This does not change the price you pay.
Example: 5 V to 3.3 V for an ESP32
ESP32 and Raspberry Pi GPIO pins are 3.3 V only. To read a 5 V signal (for example the TX line of an Arduino or a 5 V sensor output):
- R1 = 1 kΩ, R2 = 2 kΩ
- Vout = 5 × 2000 / (1000 + 2000) = 3.33 V
10 kΩ and 20 kΩ give the same ratio with ten times less current. If you do not have a 2 kΩ, two 1 kΩ in series work. Check your values with resistor color codes.
Example: Measuring a 12 V Battery
The ESP32 ADC reads up to about 3.3 V (and is most accurate well below that), so scale 12 V (up to 14.4 V when charging) down:
- R1 = 100 kΩ, R2 = 22 kΩ
- Vout at 14.4 V = 14.4 × 22 / 122 = 2.6 V
- In code: battery voltage = ADC voltage × (R1 + R2) / R2 = ADC voltage × 5.55
High values like 100 kΩ keep the battery drain tiny (about 0.1 mA), which matters for projects that run all the time. If you use ESP32 deep sleep, that drain is often bigger than the sleeping ESP32 itself, so you may want to switch the divider off with a transistor.
When NOT to Use a Voltage Divider
- To power a device. As soon as the load draws current, the output voltage drops. Use a regulator or buck converter instead.
- For fast signals like SPI at high speed: the resistors and pin capacitance slow the edges down. Use a level shifter.
- For two-way lines like I²C: use a bidirectional level shifter module.
Choosing Resistor Values
| Total resistance | Pros | Cons |
|---|---|---|
| Under 1 kΩ | Very stable signal | Wastes current, resistors may get warm |
| 10 kΩ to 100 kΩ | Good balance for microcontroller inputs | Best default |
| Over 1 MΩ | Almost no current | Sensitive to noise; ADC readings get inaccurate |
Want to skip the maths? Our voltage divider calculator finds Vout or the missing resistor in one click. And before wiring anything to an ESP32, check which ESP32 pins are safe to use.
Frequently Asked Questions
What is the voltage divider formula?
Vout = Vin × R2 / (R1 + R2), where R1 is the resistor connected to the input voltage and R2 is the resistor connected to ground. Vout is measured at the point between them.
How do I convert 5 V to 3.3 V with resistors?
A common choice is R1 = 1 kΩ and R2 = 2 kΩ (or 10 kΩ and 20 kΩ), which gives 5 × 2 / 3 = 3.33 V. This works for slow signals like a sensor output or UART RX, not for powering a circuit.
Can I use a voltage divider to power something?
No. The output voltage changes as soon as you draw current from it, and the resistors waste power. Use a voltage regulator or a buck converter to power devices.
What resistor values should I use?
Use values in the kilo-ohm range. Too low wastes current; too high makes the signal sensitive to noise and to the input current of the pin. 10 kΩ to 100 kΩ total is a good range for most microcontroller inputs.