We characterize optimal pairs of rearrangement-invariant quasinorms for which the Sobolevembedding holds.