The present invention discloses a heart rate detection method used in an earphone and an earphone capable of detecting heart rate. The method comprises: providing a cavity inside the earphone, and installing a microphone in the cavity providing an acceleration sensor in the earphone performing self-adaptive filtering process on signals collected by the acceleration sensor, and obtaining estimated signals of the signals generated by body movement of a wearer in the signals collected by the microphone subtracting the estimated signals from the signals collected by the microphone to obtain signals related to heart rate and detecting heart rate according to the signals related to heart rate. The technical scheme of the invention adopts an enclosed cavity to place the microphone to reduce interference of external noises and reinforce signal information collected by the microphone. By performing self-adaptive filtering on signals collected by the acceleration sensor to obtain estimated signals, subtracting the estimated signals from the signals collected by the microphone, and then detecting the heart rate, the influence of the body movement of the wearer on heart rate detection can be eliminated.