The problem of handwriting recognition is to interpret intelligible handwritten input automatically, which is of great interest in the pattern recognition research community because of its applicability to many fields towards more convenient input devices and more efficient data organization and processing. We have to code a complete digit recognizer and test it on the MNIST digit dataset. As a benchmark for testing classification algorithms, the MNIST dataset has been widely used to design novel handwritten digit recognition systems. The dataset consists of 70,000 gray scale images, each of size 784. The recognizer is supposed to read the image data, extract features from it and use a k-nearest neighbor classifier to recognize any test image. To carry out the experiments, we need to randomly divide it into two partitions - training and testing. The training set is used to create the classifier and test set is used to determine the accuracy.