In the field of stellar evolution, a blue loop is a stage in the life of an evolved star where it changes from a cool star to a hotter one before cooling again.  The name derives from the shape of the evolutionary track on a Hertzsprung–Russell diagram which forms a loop towards the blue (i.e. hotter) side of the diagram.
 Blue loops can occur for red supergiants, red-giant branch stars, or asymptotic giant branch stars.  Some stars may undergo more than one blue loop.  Many pulsating variable stars such as Cepheids are blue loop stars.  Stars on the horizontal branch are not generally referred to as on a blue loop even though they are temporarily hotter than on the red giant or asymptotic giant branches.  Loops occur far too slowly to be observed for individual stars, but are inferred from theory and from the properties and distribution of stars in the H–R diagram.
 Most stars on the red-giant branch (RGB) have an inert helium core and remain on the RGB until a helium flash moves them to the horizontal branch.  However, stars more massive than about 2.3 M☉ do not have an inert core.  They smoothly ignite helium before reaching the tip of the red-giant branch and become hotter while they burn helium in their cores.  More massive stars become hotter during this phase and stars from about 5 M☉ upwards are generally treated as experiencing a blue loop, which lasts on the order of a million years.  This type of blue loop occurs only once in the lifetime of a star.
 Stars on the asymptotic giant branch (AGB) have largely inert cores of carbon and oxygen, and alternately fuse hydrogen and helium in concentric shells around the core.  The onset of helium shell burning causes a thermal pulse and in some cases this will cause the star to temporarily increase its temperature and execute a blue loop.  Many thermal pulses may occur as the shells alternately switch on and off, and multiple blue loops can occur in the same star.
 Red supergiants are massive stars that have left the main sequence and greatly expanded and cooled.  Their high luminosity and low surface gravity means they are rapidly losing mass.  The most luminous red supergiants can lose mass quickly enough that they become hotter and smaller.  In the most massive stars, this can result in the star evolving permanently away from the red supergiant stage to become a blue supergiant, but in some cases the star will execute a blue loop and return to being a red supergiant.
 Stars which are executing blue loops cross the yellow portion of the H–R diagram above the main sequence, so that many of them cross a region called the instability strip because the outer layers of stars in that region are unstable and pulsate.  Stars from the asymptotic giant branch that cross the instability strip during a blue loop are thought to become W Virginis variables.  More massive stars, crossing the instability strip during a blue loop from the red-giant branch, are thought to make up the δ Cephei variables.  Both types of star have luminous and unstable photospheres at this stage of their lives and often have the spectra of supergiants, although most are not massive enough to ever fuse carbon or reach a supernova.