Nonnegative infinitely divisible (i.d.) random variables form an important class of random variables. However, when this type of random variable is specified via Lévy densities that have infinite integrals on (0, ∞), except for some special cases, exact sampling is unknown. We present a method that can sample a rather wide range of such i.d. random variables. A basic result is that, for any nonnegative i.d. random variable X with its Lévy density explicitly specified, if its distribution conditional on X ≤ r can be sampled exactly, where r > 0 is any fixed number, then X can be sampled exactly using rejection sampling, without knowing the explicit expression of the density of X. We show that variations of the result can be used to sample various nonnegative i.d. random variables.