ElectronicsInfoline

Calculators

LM317 calculator

By Bulan Sarkar

Put in R1 and R2 and get the output voltage, including the small ADJ-pin current term. Or give a voltage and get the best standard resistor pair. The same page checks the input headroom, works out how hot the regulator runs and what heatsink it needs, and sizes the single resistor for the LM317 used as a current limiter.

Share this calculator
What do you want to do?
V

Use the lowest point of the input, at the bottom of the ripple.

Ω
Ω
A

What the circuit draws. 500m or 0.5 both work.

°C
°C

TI's recommended maximum is 125 °C. 110 °C leaves some margin.

°C/W

0.8 with thermal compound. An insulating pad adds more; check its data.

headroom 6.96 Vin 12 VLM3173.52 WINOUTout 5.036 VR1240 Ω1.25 VADJR2720 Ωload 500 mA0 V
Output voltage
5.036 V
5 V if you ignore the ADJ current
Part to part
4.84 V to 5.27 V
reference 1.2 to 1.3 V, ADJ current 50 to 100 µA
Headroom
6.96 V
at least 3 V: fine
Regulator dissipation
3.52 W
505 mA through it, 41.5 % efficient
Junction, no heatsink
269 °C
TO-220 in free air, 65 °C/W: 1.08 W is the most it can shed
Heatsink needed
14 °C/W or lower
sink to air, after 5 °C/W junction to case and 0.8 °C/W interface

Figures from the TI LM317 datasheet (SLVS044Z): reference 1.2 to 1.3 V, ADJ current 50 µA typical and 100 µA maximum, 3 V headroom, 1.5 A. Thermal figures for a TO-220 in free air from the onsemi LM317 datasheet.

Quick answer

Vout = 1.25 V × (1 + R2 / R1) + IADJ × R2. For 5 V from E24 parts, 510 Ω with 1.5 kΩ gives 5.0015 V. Keep the input at least 3 V above the output and check the heat: from 12 V at 1 A the chip dissipates 7.02 W.

The formula

Vout = 1.25 V × (1 + R2 / R1) + IADJ × R2

The LM317 holds 1.25 V between its OUT and ADJ pins. R1 sits across exactly that gap, so the current through it is fixed at 1.25 V / R1: 5.2 mA with the usual 240 Ω. The same current flows on down through R2, and the output is the 1.25 V plus whatever that current drops across R2. The ADJ pin itself leaks about 50 µA (100 µA at most) into R2 as well, which adds IADJ × R2 on top. With a 1.5 kΩ R2 that is 75 mV, enough to matter when the target is 5.00 V.

LM3171ADJ2OUT3INtab = OUT
Figure 1. The TO-220 pinout. The tab is the output, so insulate it from a grounded heatsink.

The 1.25 V is itself a spread: TI specifies 1.2 V to 1.3 V across parts, temperature and load. That is ±4 %, which is why the calculator prints a part-to-part range beside the typical figure, and why precise supplies put a trimmer in R2.

Worked example in numbers

Voltage dropped
7 V
Heat
7.02 W
Efficiency
42 %
Heatsink needed
4.18 °C/W or better

Worked examples

5 V from E24 resistors

Ignore the ADJ current and 5 V needs R2 / R1 = 3 exactly, so 240 Ω with 720 Ω would do it. But 720 Ω is not an E24 value. The calculator tries every E24 R1 from 100 Ω to 1 kΩ, solves for R2 with the 50 µA term included, and rounds each way. The best pair is 510 Ω with 1.5 kΩ: 1.25 V × (1 + 1500 / 510) = 4.926 V, plus 50 µA × 1.5 kΩ = 75 mV, gives 5.0015 V,+0.029 % off. Here the ADJ current is what makes the pair land on 5 V.

That pair passes only 2.45 mA through R1, and the LM317 needs up to 10 mA flowing to hold regulation (3.5 mA typical). Fine with a load connected; with nothing on the output, the voltage can creep up. If the board is ever unloaded, take 120 Ω with 360 Ω instead: 5.018 V (+0.36 %), and R1 alone draws 10.4 mA. The runner-up in the table, 100 Ω with 300 Ω, gives 5.015 V.

1 A at 5 V from a 12 V adapter, on a 40 °C day

Same resistors, 12 V in, 1 A out. The regulator carries the load plus the divider current, 1.002 A, and drops 7 V doing it, so it dissipates 7.02 W. Only 42 % of the input power reaches the load; the rest is heat.

A TO-220 standing in free air runs at about 65 °C/W. In a 40 °C room it can shed 1.08 W before the junction reaches 110 °C, so 7.02 W needs a heatsink. Working back from 110 °C: (110 − 40) / 7.02 W = 9.98 °C/W for the whole path. Take off 5 °C/W for junction to case and 0.8 °C/W for the thermal compound, and the sink must be 4.18 °C/W or better, which calls for a large finned heatsink.

The cheaper fix is a lower input. From 9 V the drop is 4 V, still over the 3 V the LM317 needs, and the dissipation falls to 4.01 W; the sink can be as poor as 11.7 °C/W. Each volt of input above what the regulator needs adds 1 W of heat for every amp of load.

12 V in5 V out7.02 Wheat9 V in5 V out4.01 Wheat
Figure 2. Each volt above what the regulator needs turns into heat: 1 W per volt for every amp of load.
junction to case5 °C/Wcompound0.8 °C/Wheatsinkat most 4.18 °C/Wjunction 110 °Ccase 74.9 °Csink 69.3 °Cair 40 °C
Figure 3. Thermal resistances add in series, like resistors. The heatsink gets whatever the junction and compound leave over.

The LM317 as a current limiter

Leave out R2, put one resistor between OUT and ADJ, and take the load from the ADJ side. The chip still holds 1.25 V across the resistor, so the current is 1.25 V / R whatever the load does, and R = 1.25 / I. For a 350 mA LED string, R = 3.57 Ω; the next E24 value up, 3.6 Ω, gives 347 mA including the ADJ current. The resistor dissipates 1.25 V × I = 434 mW, so it wants a 1 W part.

From 12 V the load can drop up to 7.75 V and still get the full current: the resistor takes 1.25 V and the regulator wants its 3 V. If the load is ever shorted, the LM317 takes the lot, 3.73 W, so size the heatsink for that case. The current source lesson covers why a fixed voltage across a fixed resistor is a fixed current.

Headroom and dropout

The LM317 regulates only while the input stays about 3 V above the output. TI's recommended operating range starts at 3 V between input and output, and its datasheet says the part needs up to 3 V of headroom to regulate at full current and low temperature. Below that the output follows the input down, one dropout voltage under it. The check that matters is the lowest point of the input: after a rectifier and capacitor, that is the bottom of the ripple, not the DC average a meter shows.

The upper limit is 40 V between input and output, and it bites at switch-on and when the output is shorted, because then the whole input sits across the chip. A 37 V output from a 40 V input is fine; a 5 V output from a 48 V input is not.

3 V40 V7 V4 V43 V12 V → 5 V = 7 V9 V → 5 V = 4 V48 V → 5 V = 43 V, outside
Figure 4. The working window. Check the bottom of the input ripple against the 3 V end, and switch-on or a shorted output against the 40 V end.
3.5 mA typical10 mA maximumR1 510 Ω2.45 mAR1 120 Ω10.4 mA
Figure 5. If the board may run with nothing connected, use the smaller R1 so the divider alone keeps the regulator loaded.

Where the thermal numbers come from

Datasheets disagree about the TO-220, and the difference matters. The current TI datasheet (SLVS044Z) lists the KCS TO-220 at 23.5 °C/W junction to ambient, but that figure is measured on a JEDEC test board with copper planes, not for a part standing up in free air. The same table gives 0.1 °C/W junction to the tab. The onsemi datasheet gives 65 °C/W to free air and 5 °C/W junction to case. This calculator uses the onsemi pair: it is the more cautious of the two, so any error goes toward a bigger heatsink.

LM317 figures used on this page
FigureValueSource
Reference voltage1.2 / 1.25 / 1.3 VTI, min / typ / max
ADJ pin current50 µA typ, 100 µA maxTI
Minimum load current3.5 mA typ, 10 mA maxTI
Input to output3 V to 40 VTI, recommended
Output current1.5 ATI, onsemi
Junction temperature0 to 125 °CTI, recommended
TO-220, junction to air65 °C/Wonsemi (TI: 23.5 on a test board)
TO-220, junction to case5 °C/Wonsemi

The regulator thermal design lesson walks the same chain of thermal resistances, and heatsinks explains how to read a sink's °C/W rating. If the dissipation is more than a few watts, a linear regulator is probably the wrong part, and a switching one will waste far less of it.

Tips and tricks

  • Check the pinout before you solder. On the TO-220 LM317 the pins are ADJ, OUT, IN from the left, not the IN, GND, OUT of a 7805, and the metal tab is the output. If the heatsink touches the case or another part, use an insulating pad and washer.
  • Wire R1 straight to the OUT pin, close to the chip, not out at the load. Any voltage drop in the wire between them gets multiplied by the divider.
  • Add a 0.1 µF capacitor on the input pin if the main filter capacitor is more than a few centimetres away, and 1 µF or more on the output. TI's datasheet suggests both.
  • For an adjustable supply, make R2 a fixed resistor in series with a smaller trimmer. A slip of the screwdriver then can't wind the output all the way up.
  • Measure the input under full load with a scope, or at least an AC range on the meter. The DC average can look fine while the ripple troughs dip below the 3 V headroom.

What we would do

For a bench supply or a board that needs an odd voltage at up to an amp or so, we would use an LM317 in TO-220 with values from this calculator and a bolt-on heatsink sized from the thermal result. For a fixed 5 V or 3.3 V rail, a fixed regulator is simpler: a 7805, or a low-dropout part for 3.3 V. Once the chip has to burn more than a few watts, buy a ready-made buck module instead; they are cheap in India and everywhere else, and waste far less power as heat.

Questions people ask

How do I set the LM317 output voltage?

Vout = 1.25 V × (1 + R2 / R1), plus a small IADJ × R2 term. R1 goes from OUT to ADJ and R2 from ADJ to ground. For 5 V, the E24 pair 510 Ω and 1.5 kΩ gives 5.0015 V.

What input voltage does an LM317 need?

At least 3 V more than the output, measured at the bottom of the input ripple, and no more than 40 V above the output. For a 5 V output that means an input from 8 V up, and the lower you keep it the less heat the chip makes.

Does the LM317 need a heatsink?

Work out (Vin − Vout) × load current. A TO-220 standing in free air runs about 65 °C hotter than the air for every watt, so above about a watt it needs a heatsink. From 12 V at 1 A, the chip dissipates 7.02 W and needs a heatsink rated 4.18 °C/W or lower.

Why is my LM317 output too high with nothing connected?

The LM317 needs a minimum load current to regulate: 3.5 mA typical, up to 10 mA. With no load, only R1 draws current. With 510 Ω that is 2.45 mA; dropping R1 to 120 Ω raises it to 10.4 mA, which covers the worst case on its own.

Can an LM317 drive LEDs at constant current?

Yes. Put one resistor between OUT and ADJ and take the load from the ADJ side; R = 1.25 / I. For 350 mA, the next E24 value up is 3.6 Ω. Allow 1.25 V for the resistor plus 3 V for the chip on top of the LED string.

One email a month from the bench

New circuits, lessons, part guides and calculators, on the first Sunday of each month.

We'll send one email to confirm. Every email has a one-click unsubscribe. Privacy policy

Lessons behind this calculator

Author: Bulan Sarkar · Report an error

The calculation runs in your browser, so the results change as you type. The formulas are the same ones the lessons are checked against. Other calculators are on the calculators page.

For the bench: our printable reference pack (A4 PDF) collects the colour codes, standard values, pinouts and formulas on paper.