And for most modern MOSFETs in a TO-220 or similar through-hole package or a D-pack or similar SMD package if Pd < 1 - 1.5W , generally no heatsink is needed at ambient temperatures < 30degC, assuming the highlighted parameter in the datasheet <= 62degC/W.And we can calculate the power dissipated in MOSFET.
Pd = ID^2 * Rds(on)

