Path planning plays an important role in navigation and motion planning for robotics and automated driving applications. Most existing methods use iterative frameworks to calculate and plan the optimal path from the starting point to the endpoint. Iterative planning algorithms can be slow on large maps or long paths. This work introduces an end-to-end path-planning algorithm based on a fully convolutional neural network (FCNN) for grid maps with the concept of the traversability cost, and this trains a general path-planning model for 10 × 10 to 80 × 80 square and rectangular maps. The algorithm outputs the lowest-cost path while considering the cost and the shortest path without considering the cost. The FCNN model analyzes the grid map information and outputs two probability maps, which show the probability of each point in the lowest-cost path and the shortest path. Based on the probability maps, the actual optimal path is reconstructed by using the highest probability method. The proposed method has superior speed advantages over traditional algorithms. On test maps of different sizes and shapes, for the lowest-cost path and the shortest path, the average optimal rates were 72.7% and 78.2%, the average success rates were 95.1% and 92.5%, and the average length rates were 1.04 and 1.03, respectively.