Results of first-principles band-structure calculations for the ternary alkaline-earth silicon nitrides M2Si5N8 (M = Ca and Sr) are presented. In the structures of M2Si5N8 (M = Ca, Sr and Ba), the N atoms show connections to two (N) and three (N) neighbouring silicon tetrahedral centres. Calculations show that the local electronic structure is strongly dependent on the local chemical bonding. The valence band is dominated by N 2p hybridized with the s, p states of the alkaline-earth-metal and silicon atoms. The upper part of the valence band is dominated by the 2p states of N atoms, while the N 2p states lie about 2 eV below the Fermi level. The bottom of the conduction band consists of the N 3s characters hybridized with s orbitals of the alkaline-earth metals, while the s character of Si atoms is higher in energy. Sr2Si5N8 is a semiconductor with a direct energy gap at G, while Ca2Si5N8 is an indirect semiconductor. Optical diffuse reflectance spectra show an energy gap of 4.9 eV for Ca2Si5N8, 4.5 eV for Sr2Si5N8, as well as 4.1 eV for Ba2Si5N8, in fair agreement with the calculated values.