Lithium–sulfur (Li–S) batteries are an attractive candidate for the next generation energy storage systems. However, the practical use of Li–S batteries is hindered by poor cycle life and low Coulombic efficiency, which are induced by shuttle effect. Modifying the properties of a separator is an effective way to inhibit the shuttle effect. However, only physical interactions of common carbon materials are not enough to confine lithium polysulfides. In this paper, a porous carbon nanowire (N-PCNW) is designed to modify the separator. The N-PCNW with high N-doped level (7.12wt%) not only possesses excellent electron conductivity, but also traps the soluble polysulfides effectively with both physical and chemical interactions. With the N-PCNW modified separator, the pure sulfur cathode exhibits enhanced electrochemical performance, showing a high initial discharge capacity of 1430mAhg−1 at 0.2C (1C=1675mAhg−1) and good long-term cycling stability at 0.5C with 0.08% capacity fading per cycle. This design is easy and efficient, providing a great promise for the pratical use of Li–S batteries.