A block for building a toy is provided. The block includes a body, a case provided in the body, a holder with a sliding-prevention part, provided movably and rotatably within the case, and a magnet with south and north pole faces, installed in the holder. The blocks, each with this construction, can connect to each other to build a toy, without sliding off relative to each other.