All spaces are assumed to be Tychonoff. Given a realcompact space X, we denote by 
$\mathsf {Exp}(X)$ the smallest infinite cardinal 
$\kappa $ such that X is homeomorphic to a closed subspace of 
$\mathbb {R}^\kappa $. Our main result shows that, given a cardinal 
$\kappa $, the following conditions are equivalent: 
In fact, in the case 
$\mathfrak {d}\leq \kappa \leq \mathfrak {c}$, every countable dense subspace of 
$2^\kappa $ provides such an example. This will follow from our analysis of the pseudocharacter of countable subsets of products of first-countable spaces. Finally, we show that a scattered space of weight 
$\kappa $ has pseudocharacter at most 
$\kappa $ in any compactification. This will allow us to calculate 
$\mathsf {Exp}(X)$ for an arbitrary (that is, not necessarily crowded) countable space 
X.