The production of hydrogen from water using a catalyst and solar energy is an ideal future energy source, independent of fossil reserves. For an economical use of water and solar energy, catalysts that are sufficiently efficient, stable, inexpensive and capable of harvesting light are required. Here, we show that an abundant material, polymeric carbon nitride, can produce hydrogen from water under visible-light irradiation in the presence of a sacrificial donor. Contrary to other conducting polymer semiconductors, carbon nitride is chemically and thermally stable and does not rely on complicated device manufacturing. The results represent an important first step towards photosynthesis in general where artificial conjugated polymer semiconductors can be used as energy transducers.