Sulfur-doped porous carbons were synthesized by two synthetic approaches, i.e. a direct one (soft-template) and an indirect one (hard-template). In the soft-template approach, a phenolic resin based on phloroglucinol or resorcinol and thiophene carboxaldehyde (TCA) was self-assembled with a triblock copolymer followed by carbonization in inert atmosphere. For the second method, zeolite beta was used as hard-template and infiltrated with carbon by chemical vapor deposition (CVD) process followed by H2S treatment. Mesoporous materials with uniform pore size and moderate apparent specific surface area (up to 635 m2 g−1) were obtained by soft-template route. The hard-template route, coupled with H2S post-treatment, allowed to obtain highly microporous/mesoporous materials having high apparent surface area (1700–2500 m2 g−1) and high total pore volume (1.25–1.95 cm3 g−1). High temperature or amounts of TCA induce a decrease of the microporosity and apparent surface area while the mesoporosity varies distinctly depending on the synthesis method used. The sulfur content could be easily modified by the amount of thiophene carboxaldehyde for the soft-templating route (up to 10.9 wt % at 600 °C) or by the H2S heat-treatment temperature for the hard-templating method. In the latter case, with the increase of the temperature up to 900 °C, high S-content was reached (up to 14.4 wt %). The influence of the carbon porosity and surface functionality on the H2 and CO2 adsorption was evaluated. Hard-templated carbons possessing well developed microporosity adsorb the highest amounts of H2 and CO2. The sulfur and oxygen groups lead to improvement of the hydrogen adsorption capacity and have less significant effect on CO2 storage.