Lithium-sulfur (Li-S) batteries are one of the most promising energy storage systems with high energy density. However, they suffer from fast capacity fading due to the shuttle of the dissolved polysulfides. Using small sulfur molecules (S2–4) as cathodes can avoid the shuttle problem, but the preparation of ultra-microporous carbon to encapsulate S2–4 is challenging. Here, we report a Li-S battery with an excellent cycling performance by using a unique ultra-microporous carbon (UMC) with a uniform pore size of 0.55nm. The UMC was synthesized from PVDF via a facile pyrolysis process to only accommodate small S2–4 molecules and eliminate large S8 molecules. This S/UMC composite electrode is compatible with the carbonate-based electrolyte used in Li-S batteries. The resulting battery shows a typical discharging profile with only one long potential plateau because the reductions from cyclo-S8 to dissolved polysulfides and consequence shuttle problem are avoided. The S/UMC composite retains a capacity of about 852mAhg−1 and Coulombic efficiency approaching 100% after 150 cycles at 0.1C and delivers a long-term cycling at 1C for 1000 cycles with only around 0.03% capacity loss per cycle. We also tested this S/UMC composite electrode in Na-S systems and observed similar electrochemical behaviour. These results indicate that the S/UMC composite is a promising candidate as an electrode material in Li-S and Na-S batteries and related systems.