Figure 1: LM317 Resistor Calculator — enter values to calculate the result with step-by-step workings.
Table of Contents
- 3.3V Output (Logic Level)
- 5V Output (Standard Rail)
- 12V Output (Motor/Relay Supply)
- Quick Reference Table
How the LM317 Sets Output Voltage
The LM317 is the most popular adjustable linear voltage regulator — in production since the 1970s and still the default choice for simple, reliable power supplies. It maintains a constant 1.25 V reference voltage between its output pin and its adjustment pin. Two external resistors convert this fixed reference into any output voltage from 1.25 V to 37 V.
Inside the LM317, an error amplifier compares the voltage across R1 to the 1.25 V bandgap reference. If Vout drops (load increases), the amplifier drives the pass transistor harder, sourcing more current to restore the voltage. If Vout rises, the pass transistor backs off. This feedback loop holds Vout stable to within a few millivolts under changing load conditions. The Op-Amp Gain Calculator uses the same negative feedback principle — a reference, a divider, and a feedback loop that forces the output to a specific ratio.
The Formula and Why R1 = 240Ω
Solving for R2:
R2 = R1 × ((Vout/1.25) − 1)
The 1.25 V reference appears across R1, driving a fixed current of 1.25/R1 through the resistor divider. This current also flows through R2 to ground, producing a voltage drop across R2 that adds to the 1.25 V reference. The total output is the reference plus the R2 drop.
R1 = 240 Ω is the standard value because it sets the divider current to 1.25/240 = 5.2 mA — safely above the LM317’s minimum load requirement (typically 3.5–5 mA) while keeping power dissipation in the resistors low. A smaller R1 wastes current; a larger R1 risks falling below the minimum load at light output loads. The Emitter Resistor Calculator handles a similar design choice where a resistor value must balance current consumption against stability.
Example: 3.3V Output
Ratio = (3.3 / 1.25) − 1 = 1.64
R2 = 240 × 1.64 = 394 Ω
Nearest E24 standard: 390 Ω → actual Vout = 1.25 × (1 + 390/240) = 3.28 V
Or use 430 Ω → Vout = 1.25 × (1 + 430/240) = 3.49 V
Neither standard value hits 3.3 V exactly. For precision, use a 360 Ω fixed + 100 Ω trimmer pot in series. For most digital logic (which tolerates 3.0–3.6 V), 390 Ω is close enough.
Example: 5V Output
Ratio = (5.0 / 1.25) − 1 = 3.0
R2 = 240 × 3.0 = 720 Ω
Nearest E24: 750 Ω → Vout = 1.25 × (1 + 750/240) = 5.16 V
With a 9 V input: dropout = 9 − 5.16 = 3.84 V. At 0.5 A load: P = 3.84 × 0.5 = 1.92 W — needs a heatsink. The Transistor Biasing Calculator handles the related thermal analysis of power dissipation in a pass transistor.
Example: 12V Output
Ratio = (12.0 / 1.25) − 1 = 8.6
R2 = 240 × 8.6 = 2,064 Ω
Nearest E24: 2.0 kΩ → Vout = 1.25 × (1 + 2000/240) = 11.67 V
Or 2.2 kΩ → Vout = 12.71 V
For exactly 12 V, combine 1.8 kΩ + 270 Ω in series = 2,070 Ω → Vout = 12.03 V.
With 15 V input at 1 A: P = (15 − 12) × 1 = 3 W — definitely needs a heatsink with thermal resistance below 15 °C/W.
Quick Reference Table
| Vout | R2 (calc) | R2 (E24) | Actual Vout |
|---|---|---|---|
| 1.5 V | 48 Ω | 47 Ω | 1.49 V |
| 3.3 V | 394 Ω | 390 Ω | 3.28 V |
| 5.0 V | 720 Ω | 750 Ω | 5.16 V |
| 9.0 V | 1,488 Ω | 1.5 kΩ | 9.06 V |
| 12.0 V | 2,064 Ω | 2.0 kΩ | 11.67 V |
| 15.0 V | 2,640 Ω | 2.7 kΩ | 15.31 V |
| 24.0 V | 4,368 Ω | 4.3 kΩ | 23.65 V |
All values assume R1 = 240 Ω. The gap between calculated and nearest standard R2 is why the calculator shows both the ideal value and the actual Vout — so you can pick the closest standard resistor and see exactly what voltage it produces.
Dropout Voltage and Thermal Design
The LM317 needs at least 2–3 V of headroom between input and output (the dropout voltage). Vin must be at least Vout + 3 V for reliable regulation. The voltage difference is dissipated as heat in the LM317’s internal pass transistor: P = (Vin − Vout) × Iload.
Below 0.5 W: no heatsink needed (TO-220 package).
0.5–2 W: small clip-on heatsink or PCB copper pour.
2–5 W: bolt-on heatsink with thermal paste.
Above 5 W: consider a switching regulator instead — the LM317 is wasting too much power as heat.
For high-current applications where the dropout is large, a switching pre-regulator followed by the LM317 for final filtering gives the best of both worlds — high efficiency from the switcher and low noise from the linear post-regulator. The MOSFET Calculator can analyse the switching element in such a pre-regulator design.
Capacitor Requirements
The LM317 datasheet specifies minimum capacitors for stable operation:
Input (Cin): 0.1 µF ceramic, placed as close to the LM317 input pin as possible. Prevents oscillation from long input leads. Required whenever the LM317 is more than a few centimetres from the main filter capacitor.
Output (Cout): 1 µF minimum for stability. 10 µF or larger electrolytic improves transient response. Ceramic alone can cause oscillation in some configurations — always include an electrolytic or tantalum in parallel.
Adjustment pin (Cadj): An optional 10 µF electrolytic from the ADJ pin to ground improves ripple rejection by 15–20 dB. Not required for basic operation but highly recommended for audio and sensitive analogue circuits.
Accuracy and Iadj Error
The LM317’s adjustment pin draws about 50 µA, which flows through R2 and adds a small error to the output voltage: ΔV = 50 µA × R2. For a 5 V output (R2 = 720 Ω), the error is 50 × 10−6 × 720 = 36 mV — negligible for most applications. For a 24 V output (R2 = 4.3 kΩ), the error grows to 215 mV. The Shockley Diode Calculator models a similar small-current effect where a few microamps through a junction produce a measurable voltage shift.
Overall output accuracy depends on the 1.25 V reference tolerance (±4% typical for LM317), resistor tolerances, and Iadj variation. With 1% metal film resistors, the dominant error source is the reference itself. For tighter accuracy, use an LM317L (lower tolerance) or a precision adjustable reference like the LM431.
Frequently Asked Questions
How does the LM317 set output voltage?
What is the minimum output voltage?
What is dropout voltage?
Do I need capacitors?
Can I use the LM317 as a current source?
What if the nearest standard resistor does not give my target voltage?
Related Calculators
Browse all Electronics Calculators →