Read the datasheet of your chip, it says there.
Here's a datasheet from ST :
LINKGo to page 5, and you'll find there:
Top Operating junction temperature range
for L78xxC, L78xxAC 0 to 125 °C
for L78xxAB -40 to 125°C
Table 2: Thermal data
Symbol Parameter D²PAK DPAK TO-220 TO-220FP Unit
R?JC Thermal resistance junction-case 3 8 5 5 °C/W
R?JA Thermal resistance junction-ambient 62.5 100 50 60 °C/W
So your regulator will dissipate the excess energy as heat. If you have 7.5v in , 5.0v out then at 0.5A your regulator will dissipate (7.5v-5.0v ) x 0.5A = 1.25w
Now if you look at the table above, you can see that a TO-220 regulator will heat 50 degrees C over ambient temperature with every watt of heat produced, and your regulator will produce 1.25 watts, so it's only natural that your regulator will reach ambient temperature + 50 degrees C without any heatsink.
Circuit board is not very good at dissipating heat, if you put DPAK regulator on maybe 3-4 cm of copper, maybe the regulator will dissipate 1w and stay below around 90 degrees C
So you need a heatsink and you can easily figure out how big of a heatsink you'll need.
First, pick a suitable ambient temperature. It won't necessarily be room temperature, because you may have your regulator in a closed box or a box with poor air flow, not always in the open air.
So for this example, let's say the ambient temperature in your product will be up to 40c
The regulator says it will function up to 125c - INTERNAL - temperature , which is NOT the temperature of the heatsink.
For this example, let's say we want the regulator to not go over 100c and your ambient temperature could be up to 40c and you want the regulator to handle up to 1A with 7.5v input.
That means you need to dissipate (7.5v - 5v) x 1A = 2.5 watts
So :
Pd = 2.5 watts
Rjc = 5°C/W (from semiconductor manufacturer) - for the TO-220 package
Tj max = 125°C (from semiconductor manufacturer) - but we're gonna use 110c for safety
Ta max = 40°C
You have 110c (maximum temperature you want) - 40c (ambient temperature) = 70 degrees C to play with.
Quick rough check if you need heatsink or not : If you dissipate 2.5w, then the temperature increase on the regulator must be below 70c / 2.5w = 28c/w - this number is less than 45w ( 50c/w - normal temperature rise for TO-220 - MINUS 5c/w - junction-case thermal resistance for TO-220) therefore we definitely need a heatsink.
So now the maximum thermal resistance of the heatsink without any forced air will have to be this calculated value, minus the resistance between the die and the metal of the chip (junction-case temperature) and minus the thermal resistance of the thermal paste or thermal pad between the chip and the heatsink, which is generally small, usually under 0.5c/w:
Rsa = (Tj max - Tj amb ) / Pd - Rjc - R?paste
So you need a heatsink with less than Rsa = (110 - 40) / 2.5 - 5 - 0.5 = 22.5 c/w
Your heatsink must have a thermal resistance below 22.5 c/w in order to keep your regulator below 110c at 1A of current with 7.5v in and 5v out.
Here's a heatsink that would fit these constraints, barely, with 21 c/w :
https://www.digikey.com/product-detail/en/assmann-wsw-components/V7237C/A10753-ND/3476145The price differences are so small that you'd probably just want to go with something a bit bigger and much better unless you're space constrained.
For example this one has a resistance of only 13.6 c/w :
https://www.digikey.com/product-detail/en/aavid-thermalloy/575002B00000G/575002B00000-ND/126063edit : Check the PDF below for more explanations and formulas and stuff (extract from Aavid Thermalloy catalogue, they make heatsinks of all kinds)