Voltage divider calculator
Two resistors in series make a smaller voltage out of a bigger one. Enter Vin, R1 and R2 to get the output, or let the calculator find R2 for the voltage you need.
Find R2 for a target voltage
Results are arithmetic on published formulas, not measurements. Check them on your hardware. Free, no sign-up
How a voltage divider works
The same current flows through R1 and R2, so each one takes a share of the voltage in proportion to its resistance. The output is taken across R2, the resistor to ground: the bigger R2 is compared with R1, the higher the output.
Good uses and bad uses
Good: bringing a slow 5 V signal down to 3.3 V for an ESP32 or Raspberry Pi Pico input (the echo pin of an HC-SR04 ultrasonic sensor, for example), and scaling a battery or supply voltage into the range of an ADC pin.
Bad: powering a module. As soon as the load draws current the output drops, and the divider wastes current all the time. Use a voltage regulator instead.
Not for two-way lines such as I2C: a divider only works in one direction. Use a level shifter.
Choosing resistor sizes
The ratio sets the voltage; the size sets the current. Small values (hundreds of ohms) waste current. Very large values (megaohms) make the output weak: whatever it feeds, even an ADC input, pulls on it and the reading drops. For signals and ADC inputs, values between about 10 kΩ and 100 kΩ are a common compromise.
The formula
Vout = Vin × R2 / (R1 + R2) I = Vin / (R1 + R2) R2 = R1 × Vout / (Vin − Vout) With a load RL on the output, use R2 × RL / (R2 + RL) in place of R2.
Source: Ohm’s law; resistors in series and in parallel. Standard values: E12 series, IEC 60063.
Worked example
5 V down to about 3.3 V for an ESP32 input, with R1 = 10 kΩ: R2 = 10 kΩ × 3.3 V / (5 − 3.3) V = 19.4 kΩ. The nearest E12 value is 18 kΩ, which gives 3.21 V and draws 0.179 mA from the 5 V line.
The popular 1 kΩ / 2 kΩ pair for an HC-SR04 echo pin gives 5 × 2 / (1 + 2) = 3.33 V and draws 1.67 mA.
Questions and answers
Can I power a sensor or module from a voltage divider?
No. The output voltage drops as soon as the module draws current, and it changes whenever that current changes. Dividers are for signals and measurements; for power, use a voltage regulator.
Can I use a divider to connect a 5 V output to a 3.3 V input?
Yes, for one-way signals that are not too fast, such as an ultrasonic sensor’s echo pin or a 5 V device’s serial TX at usual baud rates. Put the divider on the line going into the 3.3 V board. For two-way lines such as I2C, use a level shifter instead.
Why is my measured output lower than calculated?
Whatever is connected to the output (a multimeter, an ADC input, a module) sits in parallel with R2 and lowers it. Resistor tolerance (±1 % or ±5 %) adds a small error too. Use the load field to see the effect, or pick smaller resistors so the load matters less.
Which resistor is R1 and which is R2?
R1 goes from the input voltage to the output point; R2 goes from the output point to ground. The output is the voltage across R2.
What resistor values are best for an ADC input?
The ADC sees R1 and R2 in parallel as its source, and its sampling capacitor must charge through them. Keep that resistance low: the ATmega328P datasheet, for example, is written for sources of about 10 kΩ or less. With larger resistors, add a small capacitor (for example 100 nF) from the ADC pin to ground for slow signals, or give the ADC a longer sample time.
Learn the background
Free lessons of the BoardPilot course that explain the ideas behind this calculator:
Hardware basics for software developersADC: reading the analog world
Other calculators
LED resistor calculatorI2C pull-up resistor calculatorUART baud rate calculatorPWM and timer calculatorADC sample rate calculator
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.