TensorFlow is one of the current mainstream frameworks for deep learning. As an end-to-end open source machine learning platform, it has a comprehensive and flexible ecosystem, including rich libraries and community resources. Based on the TensorFlow framework, this paper uses MNIST as the data set to build a model and make prediction, and obtains a convolutional neural network (CNN) to recognize grayscale handwritten numbers. At the same time, compared with traditional classification, the research shows that the CNN has a higher recognition rate for images, and the experimental results show that the recognition rate of the CNN reaches 99.38%.