12. Let $F_{1}$ and $F_{2}$ be the two foci of the ellipse $C$, and $AB$ be a chord of the ellipse passing through point $F_{2}$. In $\triangle F_{1} A B$,
$$
\left|F_{1} A\right|=3,|A B|=4,\left|B F_{1}\right|=5 .
$$

Then $\tan \angle F_{2} F_{1} B=$ $\qquad$
12. $\frac{1}{7}$.

Let the equation of the ellipse be $\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1$.
Then, $F_{1}(-c, 0), F_{2}(c, 0), e=\frac{c}{a}$.
Let $A\left(x_{1}, y_{1}\right), B\left(x_{2}, y_{2}\right)$. Then
$$
\begin{array}{l}
\left|F_{1} A\right|=a+e x_{1}=3, \\
\left|F_{1} B\right|=a+e x_{2}=5, \\
|A B|=\left|F_{2} A\right|+\left|F_{2} B\right|=a-e x_{1}+a-e x_{2}=4 .
\end{array}
$$

Adding the above three equations, we solve to get $a=3$.
Thus, $x_{1}=0$, which means point $A$ is on the $y$-axis.
$$
\begin{array}{l}
\text { By }\left|F_{1} A\right|^{2}+|A B|^{2}=\left|F_{1} B\right|^{2} \\
\Rightarrow \angle F_{1} A F_{2}=90^{\circ} \\
\Rightarrow \tan \angle A F_{1} F_{2}=\frac{\left|A F_{2}\right|}{\left|A F_{1}\right|}=1 \text {, } \\
\Rightarrow \tan \angle A F_{1} B=\frac{|A B|}{\left|A F_{1}\right|}=\frac{4}{3} \\
\Rightarrow \tan \angle F_{2} F_{1} B=\tan \left(\angle A F_{1} B-\angle A F_{1} F_{2}\right) \\
\quad=\frac{\tan \angle A F_{1} B-\tan \angle A F_{1} F_{2}}{1+\tan \angle A F_{1} B \cdot \tan \angle A F_{1} F_{2}}=\frac{1}{7}
\end{array}
$$