Light localization due to random imperfections in periodic media is paramount in photonics research. The group index is known to be a key parameter for localization near photonic band edges, since small group velocities reinforce light interaction with imperfections. Here, we show that the size of the smallest localized mode that is formed at the band edge of a one-dimensional periodic medium is driven instead by the effective photon mass, i.e. the flatness of the dispersion curve. Our theoretical prediction is supported by numerical simulations, which reveal that photonic-crystal waveguides can exhibit surprisingly small localized modes, much smaller than those observed in Bragg stacks thanks to their larger effective photon mass. This possibility is demonstrated experimentally with a photonic-crystal waveguide fabricated without any intentional disorder, for which near-field measurements allow us to distinctly observe a wavelength-scale localized mode despite the smallness (~1/1000 of a wavelength) of the fabrication imperfections.