We present a generalized 4×4 matrix formalism for the description of light propagation in birefringent stratified media. In contrast to previous work, our algorithm is capable of treating arbitrarily anisotropic or isotropic, absorbing or non-absorbing materials and is free of discontinous solutions. We calculate the reflection and transmission coefficients and derive equations for the electric field distribution for any number of layers. The algorithm is easily comprehensible and can be straight forwardly implemented in a computer program. To demonstrate the capabilities of the approach, we calculate the reflectivities, electric field distributions, and dispersion curves for surface phonon polaritons excited in the Otto geometry for selected model systems, where we observe several distinct phenomena ranging from critical coupling to mode splitting, and surface phonon polaritons in hyperbolic media.