S_a = \frac{E[R_a-R_b]}{\sigma_a} = \frac{E[R_a-R_b]}{\sqrt{\mathrm{var}[R_a-R_b]}}, .
The ex-post Sharpe ratio uses the same equation as the one above but with realized returns of the asset and benchmark rather than expected returns - see the second example below.