We find an optimal Sobolev-type space on $\rn$ all of whose functions admit a trace on subspaces of $\rn$ of given dimension. A corresponding trace embedding theorem with sharp range is established.