Sloping walkways are common pedestrian traffic facilities in modern cities, especially, in some cities located in mountainous terrain, such as Hong Kong, and Zurich. Compared with level walkways, sloping walkways may lead to the decrease in pedestrian flow efficiency, and are more prone to trigger crowd disasters at extreme crowd densities, for example, recent crowd stampede event in Itaewon, South Korea, did happen on a narrow ramp with an extreme crowd density. Therefore, it is important to study pedestrian flow dynamics on ramps. In this paper, we conducted single-file pedestrian flow experiments in 0°, 3°, 5°, 7°, 9°, 12°, 17°, 22°, 27° uphill and downhill conditions, and analyzed contrastively the influence of walkway slope on pedestrian flow dynamics. Our main findings are as follows. (i) Pedestrian flow efficiency is the highest in 7° downhill condition, indicating that a small downhill slope is advantageous to pedestrian flowing. (ii) Whether it is uphill or downhill, the ramp steeper than 7° will significantly decrease pedestrian flow efficiency, therefore is disadvantageous to pedestrian flowing. (iii) For a ramp, uphill and downhill pedestrian flow efficiencies are not equal. Downhill pedestrian flow efficiency is always larger than uphill pedestrian flow efficiency. These findings provide important guidance for the design of sloping walkways and the safety management of pedestrian crowds on sloping walkways.