The invention discloses a self-cleaning keyboard, relating to the technical field of computer accessories. The keyboard compriseds a shell comprising a top opening, a brush plate and a metal sheet aresymmetrically arranged on the inner walls of the two sides of the shell correspondingly. The brush plate and the metal sheet are both vertically arranged and are attached to the inner wall of the shell. One surface, opposite to the hairbrush plate, of the metal sheet is a smooth plane; a shifting block perpendicular to the hairbrush plate is fixedly connected to the hairbrush plate; a key cap isarranged at an opening in the upper end of the shell, two symmetrically-arranged connecting frames are fixedly connected to the inner bottom end of the key cap, a cleaning piece is connected between the two connecting frames through a pin shaft, the cleaning piece can be turned over when touching the shifting block, and the two sides of the cleaning piece can make contact with the brush plate andthe metal sheet respectively. The keyboard has the outstanding characteristics that kinetic energy generated by downward movement of the keyboard is used for dust removal, so that on one hand, clearances between the keyboard can be improved, on the other hand, pause can be provided when the keyboard is pressed, and the typing experience is greatly improved.