PROBLEM TO BE SOLVED: To provide a template matching condition-setting device which reduces the matching processing time on the basis of appropriate matching condition setting, and to provide a charged particle beam device.SOLUTION: A template matching condition-setting device and a charged particle beam device, are provided. The template matching condition-setting device determines a periodicity of a search area or a pattern of a template for template matching and, in the case of the presence of periodicity, sets a matching processing condition so as to perform template matching with reduced ranges of the search area and the template and, in the case of the absence of periodicity, sets the matching processing condition so as to compress an image in the search area and a template image.