A New automatic design-based inspection system called Nikon RMX has been developed. With its unique algorithm of comparing photomasks and reticles with their design data, good defect detection sensitivity and low false-defect detection are achieved. Firstly, the design data are converted into Nikon Format Data and stored in a magnetic disc device. At this time, more than one files can be merged together. A magnified image of the sample on the X-Y stage is converted to a bit-pattern image. Synchronized to the image of sample, Nikon Format Data are transferred from the disc, and a bit-pattern image of design data is generated on the frame memory. The window moves pixel by pixel in both design and sample bit-patterns. Each minute character (corner, step & isolated pattern) at the same window position is extracted by using so called Template-matching method, and compared. If the characters of the two bit-patterns are different, it means that the sample has a defect. Many kinds of templates are provided for defects on pattern edge (of 0°, 45°, 90° & any angle), defects at corner and isolated defects. Another unique point of this system is automatic resizing function (enlarging or shrinking of pattern). With this function, design-image can be matched to the sample-image precisely. All of defect analysis is performed by hardware-logic, so very fast inspection is possible.