||We study Sobolev-type embeddings involving rearrangement-invariant norms. In particular, we focus on the question when such embeddings are optimal. We concentrate on the case when the functions involved are defined on Rn. This subject has been studied before, but only on bounded domains. We first establish the equivalence of the Sobolev embedding to a new type of inequality involving two integral operators. Next, we show this inequality to be equivalent to the boundedness of a certain Hardy operator on a specific new type of cone of positive functions. This Hardy operator is then used to provide optimal domain and range rearrangement-invariant norm in the embedding inequality. Finally, the limiting case of the Sobolev embedding on Rn is studied in detail.