A magnetic encoder comprising a permanent magnet (2) secured to a rotator (1), a field detection element (4) disposed oppositely to the permanent magnet (2) through a gap and fixed to a fixed body (3), and a circuit for processing a signal from the field detection element (4), wherein the permanent magnet (2) is formed in disc shape and magnetized in one direction perpendicular to the axis of the rotator (1) and the field detection element (4) is disposed on the outer circumferential side of the permanent magnet (2) through the gap. Alternatively, the fixed body (3) is formed of an annular magnetic body having a gap in the circumferential direction and the field detection element (4) may be disposed in the gap. A small and highly accurate magnetic encoder having simple structure and extremely high resolution can be obtained.