Nowadays, a lot of computer-aided systems for Chinese handwriting education have been developed. Their general idea is to match the strokes of the learner's character with those of the template character, and then determine the handwriting errors according to the matching result. It is clear that the stroke matching accuracy is the key issue. Therefore, this paper presents an automatic matching algorithm, which can quickly match the handwritten Chinese character with the template character to the maximum degree. The advantage of our algorithm is to divide each Chinese character stroke into a series of segments and finally feed back the matching results of segments. Such more detailed matching results can not only exactly locate the handwriting errors, but also find more types of handwriting errors. In addition, our algorithm also introduces the positional relationship of the segments, which has greatly improved the matching robustness.