A linear motor has a tubular body and a rod that penetrates the tubular body in an axial direction, and is configured to displace the tubular body and the rod relative to each other in the axial direction. The linear motor includes: 12n+1 (where n is a positive integer) teeth arranged in the axial direction so as to project from an inner peripheral surface of the tubular body; 12n slots respectively formed between adjacent teeth of the plurality of teeth; 12n coils respectively disposed in the slots; and a plurality of permanent magnets held in the rod so as to be arranged in the axial direction. The respective coils are formed by being wound around an axis of the rod in an identical direction, and the number of permanent magnets positioned in the tubular body is set to 8n.