We have developed a new type of scanning in-line shape-matching sensor with a miniature optical scanner based on a simple shape-matching algorithm. The sensor consists of a sensor head, a controller, an interface board and CPU. The sensor head, with dimensions of 30 by 40 by 40 mm3, consists of a miniature optical scanner, a laser diode with a collimator lens, a photo detector and an amplifier circuit. The controller consists of signal processing circuits which generate the scanning position information from the drive circuit of the scanner. The interface board inputs binary level signals to the CPU. The CPU is used for the calculation and judgement of the obtained data and for displaying the results of its output. The shape- matching is performed by comparing the obtained scanning data to the pre-inputted original data. The original data is inputted to the memory by scanning the beam on the correct status object. If both sets of data completely agree, it defines that detected object as equal to the original object. For comparison, the most typical parameter of the data, such as the pulse width or the number of pulses, is adapted. For example, in the case of size difference between screws, each pulse width of scanned data is changed. As a result, size detection can be achieved. As this scanning type sensor, not a CCD camera type, has features such as no external lighting, lower cost and miniature size, it could be applied in the area of simplified shape matching on the factor assembly line.