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; a shell of the earphone is provided with a hole at a position where an opening of the cavity clings to, and when the earphone is worn, the cavity and the auricle which the hole clings to form an enclosed space; collecting signals generated by pressure change in the cavity by the microphone when the earphone is worn; and detecting heart rate according to the signals collected by the microphone. According to the technical scheme of the invention, the microphone is placed in the enclosed cavity formed by the cavity in the earphone and the shell of the earphone, which reduces interference of external noises, and reinforces signal information collected by the microphone.