In order to do a heelflip, first and foremost, you're going to need to learn how to do an ollie. If you do have your ollies down solid, you have enough room in between yourself and the ground in order to have your board rotate, then I say go for it. When you're doing a heelflip you want to make sure that you kick out, your heel is going to catch the edge of the board. Some people like to hit their heel off the nose and begin the rotation like that. It's very easy to mess up this trick if the board hits you in the heels or goes too high up as it rotates.
So it's very simple, all you want to do is kick out with your heel, you want to make sure you have a good and solid setup as you're doing this trick and most importantly you've got to have some pop. You have to learn and know how to do an ollie. Make sure you're getting off the ground good and high, you're kicking out with the heel. Also, you want to make sure that you don't get too overextended on this trick so you have a nice and solid rotation. If you want to be adventurous you can go for a double or even a triple heelflip. That's when your board rotates a few extra times underneath your feet. Now for landing, as usual, you want to stick your feet right on the bolts as soon as you hit the ground. Even if you're getting it in mid-air you want to have your feet over the bolts, land on the ground and ride away nice and smooth.
That's how you do a heel flip.