Over the years, I've done several projects using relays or smallish solenoids, that used dozens to hundreds of mA. So I always just put a 1N400x diode across them, called it "good", and never had a problem.
Now I'm doing one that uses hefty solenoids that draw 4-6A. I'm guessing that their coils will store a lot more energy to be dissipated, but I don't really know, and I'm wondering whether I need to use a diode with a higher current rating. Is there a formula for this?