Direct production of hydrogen from water and sunlight requires stable and abundantly available semiconductors with well positioned band edges relative to the water red-ox potentials. We have used density functional theory (DFT) calculations to investigate 300 oxides and oxynitrides in the Ruddlesden-Popper phase of the layered perovskite structure. Based on screening criteria for the stability, bandgaps and band edge positions, we suggest 20 new materials for the light harvesting photo-electrode of a one-photon water splitting device and 5 anode materials for a two-photon device with silicon as photo-cathode. In addition, we explore a simple rule relating the bandgap of the perovskite to the number of octahedra in the layered structure and the B-metal ion. Finally, the quality of the GLLB-SC potential used to obtain the bandgaps, including the derivative discontinuity, is validated against G 0 W 0 @LDA gaps for 20 previously identified oxides and oxynitrides in the cubic perovskite structure.