Synthesis planning is the process of recursively decomposing target molecules into available precursors. Computer-aided retrosynthesis can potentially assist chemists in designing synthetic routes, but at present it is cumbersome and can't provide results of satisfactory qualities. In this study, we have developed a template-free self-corrected retrosynthesis predictor (SCROP) to predict retrosynthesis by using Transformer neural networks. In the method, the retrosynthesis planning was converted to a machine translation problem from the products to molecular linear notations of reactants. By coupling with a neural network-based syntax corrector, our method achieved an accuracy of 59.0% on a standard benchmark dataset, which outperformed >21% over other deep learning methods and >6% over template-based methods. More importantly, our method was 1.7 times more accurate than other state-of-the-art methods for compounds not appearing in the training set.