Results are presented of a search for compositeness in electrons and muons using a data sample of pp collisions at a center-of-mass energy root s = 7 TeV collected with the CMS detector at the LHC and corresponding to an integrated luminosity of 5.0 fb(-1). Excited leptons (l*) are assumed to be produced via contact interactions in conjunction with a standard model lepton and to decay via l* -> l gamma, yielding a final state with two energetic leptons and a photon. The number of events observed in data is consistent with that expected from the standard model. The 95% confidence upper limits for the cross section for the production and decay of excited electrons (muons), with masses ranging from 0.6 to 2 TeV, are 1.48 to 1.24 fb (1.31 to 1.11 fb). Excited leptons with masses below 1.9 TeV are excluded for the case where the contact interaction scale equals the excited lepton mass. The limits on the cross sections are the most stringent ones published to date. (c) 2013 CERN. Published by Elsevier B.V. All rights reserved.