5. As shown in Figure 1, the plane containing
square $A B C D$ and the plane containing
square $A B E F$ form a $45^{\circ}$ dihedral angle.
Then the angle formed by the skew lines $A C$ and
$B F$ is $\qquad$
5. $\arccos \frac{2-\sqrt{2}}{4}$.

Let's assume the side length of the square is 1. Then
$$
\begin{array}{l}
\cos \langle\overrightarrow{A C}, \overrightarrow{B F}\rangle=\frac{\overrightarrow{A C} \cdot \overrightarrow{B F}}{\sqrt{2} \cdot \sqrt{2}} \\
=\frac{(\overrightarrow{A D}+\overrightarrow{D C}) \cdot(\overrightarrow{B A}+\overrightarrow{A F})}{2} \\
=\frac{\overrightarrow{A D} \cdot \overrightarrow{B A}+\overrightarrow{A D} \cdot \overrightarrow{A F}+\overrightarrow{D C} \cdot \overrightarrow{B A}+\overrightarrow{D C} \cdot \overrightarrow{A F}}{2} \\
=\frac{0+\cos 45^{\circ}+(-1)+0}{2}=\frac{\sqrt{2}-2}{4} .
\end{array}
$$

Therefore, the angle between $A C$ and $B F$ is $\arccos \frac{2-\sqrt{2}}{4}$.