To find the value of \( x \) when \( f(x) = 4 \) for the function \( f(x) = 2^x \), we set up the equation:
\[ 2^x = 4 \]
We know that \( 4 \) can be expressed as a power of \( 2 \): \[ 4 = 2^2 \]
So we can rewrite the equation as:
\[ 2^x = 2^2 \]
Since the bases are the same, we can set the exponents equal to each other:
\[ x = 2 \]
Thus, the value of \( x \) when \( f(x) = 4 \) is:
\[ \boxed{2} \]