Voltage Regulator Pinout: 7805 / 7812 (IN-GND-OUT) vs LM317 (ADJ-OUT-IN), and How to Wire Them
Three of the most common linear regulators come in the same TO-220 package and look identical on the bench — yet their pinouts are not the same.
The fixed 78xx parts (7805, 7812) are IN – GND – OUT with the metal tab tied to ground; the adjustable LM317 is
ADJ – OUT – IN with the tab tied to output. Drop an LM317 into a 7805 layout and you swap input for output and short your output to the ground plane — a classic, smoke-producing mistake.
This guide lays out both pinouts, the headroom each needs, the LM317 output formula, and the bypass caps — then send the numbers to the
Ohm’s Law Calculator.
Pinout comparison table
Hold the regulator with the printed (front) face toward you and the pins pointing down, then read the pins left → right. With that single, consistent orientation the three parts line up like this:
| Part | Pin 1 | Pin 2 | Pin 3 | Metal tab |
|---|---|---|---|---|
| 7805 (5V) | IN | GND | OUT | GND |
| 7812 (12V) | IN | GND | OUT | GND |
| LM317 (adj.) | ADJ | OUT | IN | OUT |
⚠️ The 78xx tab is on the GND net, but the LM317 tab is on the OUT net. If you bolt either part to a grounded heatsink, the LM317 needs an insulating washer or its output will short to ground.
78xx pinout: IN – GND – OUT
The 78xx family (7805 = 5V, 7812 = 12V, and so on) are fixed positive regulators. In the TO-220 package, looking at the printed face with pins down and reading left to right:
- Pin 1 — IN: unregulated input voltage (must be above the output by the headroom, see below).
- Pin 2 — GND: common ground for both input and output. The metal tab is electrically connected to this pin (GND).
- Pin 3 — OUT: the regulated output (5V for a 7805, 12V for a 7812).
Because the tab is ground, a 78xx can usually be bolted straight to a grounded chassis or heatsink without an insulator — convenient, and the opposite of the LM317.
LM317 pinout: ADJ – OUT – IN
The LM317 is an adjustable positive regulator. Same TO-220 orientation (printed face toward you, pins down, left → right), but the order is different:
- Pin 1 — ADJ: adjustment pin; the resistor divider that sets the output voltage connects here.
- Pin 2 — OUT: the regulated output. The metal tab is connected to OUT — not ground.
- Pin 3 — IN: the unregulated input.
Note that IN and OUT are swapped relative to the 78xx, and the adjustment pin sits where the 78xx puts its input. See the LM317 pinout page and the LM7805 pinout page for the side-by-side packages.
Why they differ — and the tab trap
There is no universal standard that forces every TO-220 regulator to use the same pin order; each datasheet defines its own. The 78xx settled on IN-GND-OUT with a grounded tab, while the LM317’s topology (it regulates the 1.25V between OUT and ADJ) makes OUT the natural reference, so its tab is bonded to OUT.
Input headroom / dropout
These are linear regulators: the input must stay above the output by a minimum headroom (dropout) voltage, or the output stops regulating and sags.
| Part | Output | Headroom needed | Typical min Vin |
|---|---|---|---|
| 7805 | 5V fixed | Vout + 2–2.5V | ≥ ~7V |
| 7812 | 12V fixed | Vout + 2–2.5V | ≥ ~14.5V |
| LM317 | 1.25V – ~37V (set by R1/R2) | ~3V above Vout | Vout + ~3V |
So a 7805 wants roughly ≥ 7V in for a clean 5V out, a 7812 wants ≥ 14.5V in for 12V out, and an LM317 wants about 3V above whatever output you set. If you are running from a battery and want to know how long it will last including the regulator’s quiescent draw plus the load, feed the numbers into the Battery Life Calculator.
LM317 output formula
The LM317 holds a constant 1.25V reference between OUT and ADJ. With R1 between OUT and ADJ, and R2 from ADJ to ground, the output is:
Vout = 1.25 × (1 + R2 / R1)
R1 is typically 240Ω (this sets a steady minimum load current through the divider). R2 is the value you change to set the output. A few worked points with R1 = 240Ω:
- R2 = 720Ω → 1.25 × (1 + 720/240) = 1.25 × 4 = 5V.
- R2 = 2160Ω → 1.25 × (1 + 9) = 12.5V (close to a 7812 replacement, with adjustment).
- R2 = 0Ω (ADJ to OUT) → 1.25 × 1 = 1.25V (the minimum).
Use the Ohm’s Law Calculator to back-solve R2 for a target voltage and to check the divider current. The same calculator gives you the power dissipation that decides whether you need a heatsink (next section), and the LED Resistor Calculator is handy if the regulated rail drives indicators.
Bypass caps & heat
Bypass capacitors
For stable operation the datasheets recommend bypass capacitors close to the part: roughly 0.33µF at the input and 0.1µF at the output. The input cap matters most when the regulator sits far from the supply’s filter cap; the output cap improves transient response and stability. (The LM317 also benefits from a larger output cap and a protection diode in many designs — check the datasheet.)
Heat dissipation
A linear regulator burns off the entire voltage difference as heat. The dissipation is:
P = (Vin − Vout) × Iout
Example: 12V in, 5V out, 0.5A load → (12 − 5) × 0.5 = 3.5W. That much heat needs a heatsink. The bigger the input-to-output gap and the higher the current, the more cooling you need — and remember the LM317 tab is OUT, the 78xx tab is GND, so insulate accordingly when mounting to a shared heatsink.
FAQ
- Can I swap a 7805 and an LM317 in the same layout?
- No — they are not pin-compatible. A 78xx fixed regulator in a TO-220 (printed face toward you, pins down, read left to right) is IN – GND – OUT, and its metal tab is connected to GND. An LM317 in the same package is ADJ – OUT – IN, and its tab is connected to OUT, not ground. Dropping an LM317 into a 7805 footprint puts the input on the output pin and ties the OUT-connected tab to your ground plane — a classic way to destroy the part. Always check the datasheet pinout before substituting.
- What is the minimum input voltage I need?
- These are linear regulators, so the input must stay above the output by the dropout/headroom voltage. A 78xx needs roughly Vout + 2 to 2.5V at the input: a 7805 needs about 7V or more, a 7812 needs about 14.5V or more. The LM317 needs about 3V of headroom above whatever output you set. Below that headroom the output sags and stops regulating, so size your supply with margin.
- How do I set the LM317 output voltage?
- The LM317 holds a fixed 1.25V reference between its OUT and ADJ pins. Put R1 (typically 240Ω) between OUT and ADJ, and R2 from ADJ to ground. The output is Vout = 1.25 × (1 + R2/R1). For example, with R1 = 240Ω and R2 = 720Ω you get 1.25 × (1 + 3) = 5V. Use the Ohm’s Law Calculator to work the resistor values and the current through the divider.
- Does a voltage regulator need a heatsink?
- It depends on the dissipation. A linear regulator burns off all of (Vin − Vout) × Iout as heat. At 12V in, 5V out, 0.5A that is (12 − 5) × 0.5 = 3.5W — enough to need a heatsink. At a few tens of milliamps with low headroom you may get away with no heatsink. Compute the dissipation first; the larger the input-to-output gap and the load current, the more cooling you need.