The invention discloses an all-optical switch based on a sulfur phase-change material and a preparation method thereof, and belongs to the field of optical communication. The all-optical switch comprises a coverage layer film, a sulfur phase-change material film, an isolation layer film, a silicon photonic crystal and a substrate which are sequentially stacked. The silicon photonic crystal comprises a nanometer porous structure, and the silicon photonic crystal has the fano resonance effect. When the all-optical switch is in use, the state of the sulfur phase-change material film is controlledthrough laser, the resonance state of the silicon photonic crystal is regulated, the signal light transmissivity is modulated, the modulation range is the communication wave band being 1,500 nanometers to 1,600 nanometers, and the optical switch is obtained. The all-optical switch has the advantages of being high in contrast ratio and speed and low in power consumption. The structure is simple, the production cost can be lowered, and the switch is suitable for CMOS integrated, capable of being easily matched with a modern semiconductor technology production line, and applicable to industrialproduction and productization.