Two methods, and which to trust
The 12-minute run is the Cooper test, published by Kenneth Cooper in 1968. Run as far as you can in exactly twelve minutes, and VO2 max is the distance in metres minus 504.9, divided by 44.73. It needs effort and a measured route, and in return it is the better of the two.
The heart rate method comes from Uth and colleagues, 2004: VO2 max is about 15.3 times your maximum heart rate divided by your resting heart rate. It needs no exercise at all, which is its appeal, and if you do not know your true maximum, the age-based estimate from Tanaka's formula adds error of its own.