The purpose of this paper is to provide analytical and numerical solutions of the formation and evolution of the localized plastic zone in a uniaxially loaded bar with variable cross-sectional area. An energy-based variational approach is employed and the governing equations with appropriate physical boundary conditions, jump conditions, and regularity conditions at evolving elasto-plastic interface are derived for a fourth-order explicit gradient plasticity model with linear isotropic softening. Four examples that differ by regularity of the yield stress and stress distributions are presented. Results for the load level, size of the plastic zone, distribution of plastic strain and its spatial derivatives, plastic elongation, and energy balance are constructed and compared to another, previously discussed non-variational gradient formulation.