
Both are three-pin linear regulators in the same TO-220 package, so they look alike. The difference is what they do. The 7805 gives a fixed 5 V. The LM317 gives any voltage you choose with two resistors. Here is how to pick.
At a glance
| Feature | 7805 | LM317 |
|---|---|---|
| Output | Fixed 5 V | Adjustable, about 1.25 V up to 37 V |
| Max current | Up to 1.5 A with a heatsink | Up to 1.5 A with a heatsink |
| Parts needed | Two small capacitors | Two resistors plus capacitors |
| Dropout | About 2 V | About 2 V or more, depends on load |
| Best for | Simple 5 V rails | Variable supplies, odd voltages, chargers |
Exact limits vary slightly by manufacturer and package. Read the datasheet of the part you buy.
Pinouts (TO-220, front face towards you)
Hold the part with the flat printed side facing you and the legs pointing down.
| Pin (left to right) | 7805 | LM317 |
|---|---|---|
| 1 | Input | Adjust |
| 2 | Ground | Output |
| 3 | Output | Input |
| Metal tab | Ground | Output |
Note that the pin order is different. Swapping them by mistake is a common way to destroy a regulator. The LM317 tab is connected to the output, so do not let it touch a grounded heatsink unless you insulate it.
The LM317 formula
Two resistors set the output voltage. R1 is connected from output to the adjust pin, and R2 is from the adjust pin to ground.
Vout = 1.25 x (1 + R2 / R1)
The regulator holds 1.25 V across R1. The same current flows through R2, which adds to the output. A very small adjust pin current also flows through R2, and for most hobby work it can be ignored.
Worked example
- Choose R1 = 240 ohm, a common value from the datasheet.
- You want 5 V, so 5 / 1.25 = 4. That means 1 + R2/R1 = 4, so R2/R1 = 3.
- R2 = 3 x 240 = 720 ohm.
Use a 240 ohm resistor for R1 and a 1 k preset for R2, and set the output with a multimeter. Because R1 of 240 ohm carries about 5 mA, it also helps give the regulator the small minimum load it needs.
Dropout and input voltage
A linear regulator needs the input to be higher than the output by a margin called dropout. For both parts, plan on at least about 2 to 3 V of headroom. For a 5 V output from a 7805, that is roughly a 7 to 8 V input minimum. Do not run it close to the maximum input rating either, because the extra voltage turns into heat.
Heat: the real limit
A linear regulator wastes the voltage difference as heat.
Power lost = (Vin minus Vout) x load current
| Vin | Vout | Current | Heat |
|---|---|---|---|
| 9 V | 5 V | 200 mA | 0.8 W |
| 12 V | 5 V | 500 mA | 3.5 W |
| 12 V | 5 V | 1 A | 7 W |
At a few hundred milliamps with a large drop, you need a heatsink. If the metal body is too hot to touch, lower the input voltage, reduce the load, or add a bigger heatsink. For large drops at high current, consider a switching regulator module instead.
Which should you use?
- Choose the 7805 for a plain 5 V rail for Arduino, logic ICs or sensors.
- Choose the LM317 when you need 3.3 V, 6 V, 9 V or a variable bench supply.
- If you need a lower dropout or high efficiency, look at a low-dropout or switching regulator.
Before testing, you might want to read our multimeter guide and resistor colour code guide.
Buy the parts
Konark Radio Centre in Ashok Nagar, Bhubaneswar, supplies regulators, resistors, capacitors and heatsinks. Tell us the voltage and current you need on WhatsApp, or visit the shop. Browse our project kits as well.
Frequently asked questions
Can I use an LM317 to make a fixed 5 V supply?
Yes. With R1 = 240 ohm and R2 = 720 ohm the formula gives 5 V. In practice you would use a preset or a close standard resistor pair and check the output with a multimeter, since resistor tolerance shifts the result.
Why does my 7805 get so hot?
It burns off the difference between input and output as heat. Power lost is (Vin minus Vout) times load current. A 12 V input at 500 mA into a 5 V output wastes about 3.5 W, which needs a heatsink.
What input voltage does a 7805 need?
The input must stay a couple of volts above the output, so around 7 V or more for a stable 5 V. Check the datasheet of your exact part for the maximum input voltage, and stay well below it.
Do I need capacitors with these regulators?
Usually yes. A small capacitor on the input and one on the output keep the regulator stable and quiet. Typical datasheet values are around 0.33 µF on the input and 0.1 µF on the output for a 7805, but follow the datasheet for your part.
Need the parts?
Send the parts list on WhatsApp or walk in. Plot No. 39/F, Ashok Nagar, near Sreeleathers, open 10 AM to 9 PM, all 7 days.