7812 and TIP122

Just found a 7812 voltage regulator and two TIP122 transistors in a box with electronics. They look alike and I'm not exactly sure what's the difference between them. If I understood how voltage regulators work (transistors I know) if I input let say 20V through them, on one of the pins they'll output 12V, right?

The 7812 is a 12 V regulator. The TIP122 is an NPN bipolar power transistor. You would need to add other components to make it a regulator.

Get thee to a datasheet!

The 78xx range is simple enough providing you have a capacitor on the input/outputs of the reg.

Face the 78xx towards you so you can read it from left to right, pin 1 be your input voltage, 2 goes to gnd, 3 is your spit out regulated voltage.

They look alike and I'm not exactly sure what's the difference

They look alike because they use the TO-220 package.

TO stands for "Transistor" "Outline" and Number 220 is the "outline" or package "design", meaning it adheres to specific dimensions.

The only way you know "what goes on inside" is to, for example, "Google" for a DATASHEET based on the stamped part number.

7812 - Motorola MC7809 datasheet pdf

TIP122 - HTTP 301 This page has been moved

Regulators regulate voltage, transistors are used as light switches either on/off except they can be nanipulated to do a whole range of tasks too, a transistor is like a swiss army knife while the vReg does 1 job only.. unless you mess with it's adjust pin to make it variable

A 555 would be considered a utility belt full if tools