When flipping a fair coin twice, each flip has two possible outcomes: heads (H) or tails (T).
The sample space is given by
$$S=\{HH,HT,TH,TT\}$$
Let $E$ be the even of getting two heads, then
$$E=\{HH\}$$
Thus, the probability of getting two heads in a row is given by
\begin{align*}
P(E) &= \frac{n(S)}{n(E)}\\
&= \frac{1}{4}.
\end{align*}
Therefore, the probability of getting two heads in a row when flipping a fair coin twice is $\frac{1}{4}$.