We study the photoevaporation of molecular clumps exposed to a UV radiation field including hydrogen-ionizing photons ( h \nu > 13.6 eV ) produced by massive stars or quasars . We follow the propagation and collision of shock waves inside clumps and take into account self-shielding effects , determining the evolution of clump size and density with time . The structure of the ionization-photodissociation region ( iPDR ) is obtained for different initial clump masses ( M = 0.01 - 10 ^ { 4 } { M } _ { \odot } ) and impinging fluxes ( G _ { 0 } = 10 ^ { 2 } -10 ^ { 5 } in units of the Habing flux ) . The cases of molecular clumps engulfed in the HII region of an OB star and clumps carried within quasar outflows are treated separately . We find that the clump undergoes in both cases an initial shock-contraction phase and a following expansion phase , which lets the radiation penetrate in until the clump is completely evaporated . Typical evaporation time-scales are \simeq 0.01 Myr in the stellar case and 0.1 Myr in the quasar case , where the clump mass is 0.1 { M } _ { \odot } and 10 ^ { 3 } { M } _ { \odot } respectively . We find that clump lifetimes in quasar outflows are compatible with their observed extension , suggesting that photoevaporation is the main mechanism regulating the size of molecular outflows .