Historically, necrosis has been considered a passive process, which is induced by extreme stress or damage. However, recent findings of necroptosis, a programmed form of necrosis, shed a new light on necrosis. It has been challenging to detect necrosis reliably in vivo, partly due to the lack of genetically encoded sensors to detect necrosis. This is in stark contrast with the availability of many genetically encoded biosensors for apoptosis. Here we developed Necrosensor, a genetically encoded fluorescent sensor that detects necrosis in Drosophila, by utilizing HMGB1, which is released from the nucleus as a damage-associated molecular pattern (DAMP). We demonstrate that Necrosensor is able to detect necrosis induced by various stresses in multiple tissues in both live and fixed conditions. Necrosensor also detects physiological necrosis that occurs during spermatogenesis in the testis. Using Necrosensor, we discovered previously unidentified, physiological necrosis of hemocyte progenitors in the hematopoietic lymph gland of developing larvae. This work provides a new transgenic system that enables in vivo detection of necrosis in real time without any intervention.