Anti-flooding safety device for a washing machine, in particular for household use, said device comprising a valve body in which a duct is defined for the passage of a liquid, comprising: - an inlet section , for connecting the device to a liquid supply source; - an outlet section for connecting the device to a supply tube (T1) for supplying said liquid into a washing machine, wherein a second tube (T2) surrounds the supply tube (T1), thereby forming a hollow space (SC); - an intermediate section having a passage for the liquid and connecting said inlet section to said outlet section , wherein the anti-flooding device comprises: - a shut-off device comprising a closing element movably arranged in said intermediate section for opening and/or closing said passage , said closing element comprising a first magnet ; - an actuation device positioned, at least partially, in a chamber of the valve body in fluidic communication with the hollow space (SC), said actuation device comprising a second magnet mounted on a rotary holder , wherein the holder is associated with a blocking element arranged to retain the holder and the second magnet in a first position, so as to repel the first magnet with opposite polarization and preload the shut-off device by means of the first magnet in order to keep the passage open; - a reaction element, which reacts with the leakage liquid entering the chamber of the valve body through the hollow space (SC), said device being characterized in that : said reaction element consists of a flexible membrane associated with the blocking element , said flexible membrane being sensitive to the increased pressure in the chamber caused by a leakage from the first tube (T1) and being adapted to produce a displacement of the blocking element , wherein said displacement frees the holder , which will then turn also because of the repulsion between the first magnet and the second magnet , and move the second magnet from said first position to a second position, in which the second magnet exerts attraction on the first magnet in order to close the passage . - an inlet section , for connecting the device to a liquid supply source; - an outlet section for connecting the device to a supply tube (T1) for supplying said liquid into a washing machine, wherein a second tube (T2) surrounds the supply tube (T1), thereby forming a hollow space (SC); - an intermediate section having a passage for the liquid and connecting said inlet section to said outlet section , - a shut-off device comprising a closing element movably arranged in said intermediate section for opening and/or closing said passage , said closing element comprising a first magnet ; - an actuation device positioned, at least partially, in a chamber of the valve body in fluidic communication with the hollow space (SC), said actuation device comprising a second magnet mounted on a rotary holder , wherein the holder is associated with a blocking element arranged to retain the holder and the second magnet in a first position, so as to repel the first magnet with opposite polarization and preload the shut-off device by means of the first magnet in order to keep the passage open; - a reaction element, which reacts with the leakage liquid entering the chamber of the valve body through the hollow space (SC), <EOS>