This trick is a close relation of the kickflip and is also the root of many more complex heelflip variations.
To do a heel flip, put your feet in the same position as in an ollie, but your leading foot should be hanging off the board along the toe-side edge. Pop an ollie and as you slide your leading foot forward, kick it off your board to the toe side. This should make the board rotate in an anti-clockwise direction (the opposite to a kickflip). The important part is moving your leading foot out of the way of the board. Then, when it spins halfway, bring it back, and as the board finishes spinning smack it down with both feet.
It might take a while to get used to flipping the board the opposite way to a kickflip, but once you’ve learnt it, you won’t lose the skill for a long while.
If your having trouble flipping it, experiment with the angle of your foot and try flipping harder.



