There is provided a detection device which is capable of detecting a state of a moving member such as an origin position of the moving member in a short time. The detection device (1, 2, 3, and 4) is provided with a dog (16) which includes the multiple slits (S), in which at least one of a separation distance between adjacent slits (S) and a width of the slits (S) themselves is formed in multiple kinds, a sensor (17) which detects the presence or absence of the slits (S), a count position acquisition section (30) which acquires a count start position (Ps) and a count end position (Pe) corresponding to the separation distance between the adjacent slits (S) or the width of the slits (S) themselves based on detection results of the sensor (17), and a state detection section (40, 50, and 85) which acquires a count value increase or decrease number from the count start position (Ps) to the count end position (Pe) and detects a state of the moving member (12) based on the acquired count value increase or decrease number.