An electronic device and a method for measuring heart rate are disclosed. A heart rate measuring method of an electronic device, according to the present invention, comprises the steps of: capturing an image including a user's face; grouping the user's face, included in the image, into a plurality of regions including a plurality of pixels of similar colors; acquiring an information on a user's heart rate by inputting information on the plurality of grouped regions to an artificial intelligence learning model; and outputting the acquired information on heart rate. Therefore, the electronic device can measure the user's heart rate more accurately through the captured image.