It is a device that has the ability to convert a mechanical movement (linear and rotational) into an electrical signal so that different characteristics of that signal can be used.  Encoder is a type of motion sensor. If the motion sensed by the encoder is rotary, we call it an angular or rotary encoder, and if the motion sensed is linear, we call it a linear encode.