How to set an LM317 output voltage
How the LM317 formula works
Vout = 1.25 × (1 + R2 / R1) + Iadj × R2
The LM317 keeps 1.25 V between its OUT and ADJ pins. R1 sits across that reference, so a fixed current flows through it and on through R2; the voltage across R2 is added to the 1.25 V. The small current out of the ADJ pin (Iadj, about 50 µA) adds a few tens of millivolts.
R1 is usually between 120 Ω and 240 Ω so the divider alone draws the few milliamps the regulator needs to stay in regulation with no load. The calculator tries every standard R1 from 100 Ω to 1 kΩ and lists the pairs closest to your target.
The regulator needs about 1.7 V to 2.3 V more at its input than at its output (the dropout), and everything in between turns into heat: P = (Vin − Vout) × I. A TO-220 package with no heatsink reaches its 125 °C limit at only around 2 W.
Worked example: 5 V at 500 mA from a 12 V adapter
You want 5 V for a 500 mA load, starting from the classic R1 = 240 Ω.
- Exact R2 for 240 Ω
R2 = (5 − 1.25) / (1.25/240 + 50 µA) ≈ 713 Ω - Closest E12 pair (R1 = 270 Ω, R2 = 820 Ω)
1.25 × (1 + 820/270) + 50 µA × 820 ≈ 5.09 V - Minimum input voltage
5 V + 1.84 V dropout ≈ 6.84 V - Heat from a 12 V input
(12 − 5) × 0.5 A = 3.5 W
With 270 Ω and 820 Ω you get about 5.09 V. At 3.5 W the bare package would reach about 200 °C, so a heatsink is required (a small one brings it down to about 95 °C), or use a lower input voltage.
Common mistakes
Swapping R1 and R2
R1 goes between OUT and ADJ, R2 between ADJ and ground. Swapped, 240 Ω/720 Ω gives about 1.7 V instead of 5 V.
Forgetting the dropout
A 5 V USB input cannot give 5 V out: the LM317 needs roughly 2 V of headroom. Below that the output just follows the input minus the dropout.
Ignoring the heat
Dropping 12 V to 5 V at 1 A means 7 W of heat. Beyond 1 W to 2 W use a heatsink, and for large drops consider a buck converter instead.
Choosing R1 too large
With R1 at several kilohms the divider no longer provides the regulator's minimum load, and the output rises when the load is disconnected. Keep R1 at or below about 240 Ω if the load can be absent.
LM317 FAQ
R1 = 240 Ω with R2 = 720 Ω (two parts, or a trimmer) gives about 5.0 V. With single E12 values, 270 Ω and 820 Ω give about 5.09 V.
R1 = 240 Ω and R2 = 390 Ω give about 3.30 V. The ESP32 and other 3.3 V boards are fine with that, but a dedicated 3.3 V LDO wastes less power.
The output voltage plus the dropout, about 1.7 V at light load and up to about 2.3 V at 1.5 A. For 12 V out at 1 A, feed it at least 14 V to 15 V.
Multiply the voltage it drops by the current: (Vin − Vout) × I. Up to about 1 W a bare TO-220 is fine; around 2 W it reaches its limit; above that use a heatsink sized for the power.
1.5 A for the TO-220 version, as long as the heat stays within limits. The small TO-92 LM317L is limited to 100 mA.








