Purpose: Pencil beam algorithms are commonly used for proton therapy dose calculations. Szymanowski and Oelfke ["Two-dimensional pencil beam scaling: An improved proton dose algorithm for heterogeneous media," Phys. Med. Biol. 47, 3313-3330 (2002)10.1088/0031-9155/47/18/304] developed a two-dimensional (2D) scaling algorithm which accurately models the radial pencil beam width as a function of depth in heterogeneous slab geometries using a scaled expression for the radial kernel width in water as a function of depth and kinetic energy. However, an assumption made in the derivation of the technique limits its range of validity to cases where the input expression for the radial kernel width in water is derived from a local scattering power model. The goal of this work is to derive a generalized form of 2D pencil beam scaling that is independent of the scattering power model and appropriate for use with any expression for the radial kernel width in water as a function of depth. Methods: Using Fermi-Eyges transport theory, the authors derive an expression for the radial pencil beam width in heterogeneous slab geometries which is independent of the proton scattering power and related quantities. The authors then perform test calculations in homogeneous and heterogeneous slab phantoms using both the original 2D scaling model and the new model with expressions for the radial kernel width in water computed from both local and nonlocal scattering power models, as well as a nonlocal parameterization of Molière scattering theory. In addition to kernel width calculations, dose calculations are also performed for a narrow Gaussian proton beam. Results: Pencil beam width calculations indicate that both 2D scaling formalisms perform well when the radial kernel width in water is derived from a local scattering power model. Computing the radial kernel width from a nonlocal scattering model results in the local 2D scaling formula under-predicting the pencil beam width by as much as 1.4 mm (21%) at the depth of the Bragg peak for a 220 MeV proton beam in homogeneous water. This translates into a 32% dose discrepancy for a 5 mm Gaussian proton beam. Similar trends were observed for calculations made in heterogeneous slab phantoms where it was also noted that errors tend to increase with greater beam penetration. The generalized 2D scaling model performs well in all situations, with a maximum dose error of 0.3% at the Bragg peak in a heterogeneous phantom containing 3 cm of hard bone. Conclusions: The authors have derived a generalized form of 2D pencil beam scaling which is independent of the proton scattering power model and robust to the functional form of the radial kernel width in water used for the calculations. Sample calculations made with this model show excellent agreement with expected values in both homogeneous water and heterogeneous phantoms. © 2013 American Association of Physicists in Medicine.