[step:Prove all transcendence bases have the same cardinality via the exchange argument]Let $B$ and $B'$ be two transcendence bases for $L/k$. We must show $|B| = |B'|$.
We first handle the case where at least one of the two bases is finite, say $|B| = n < \infty$. Write $B = \{b_1, \ldots, b_n\}$. We prove by induction on $i$ that for each $0 \leq i \leq n$, there exist distinct elements $b'_1, \ldots, b'_i \in B'$ such that $\{b'_1, \ldots, b'_i, b_{i+1}, \ldots, b_n\}$ is a transcendence basis for $L/k$.
The base case $i = 0$ holds with $B$ itself. For the inductive step, suppose $\{b'_1, \ldots, b'_i, b_{i+1}, \ldots, b_n\}$ is a transcendence basis. Since $B'$ is a transcendence basis, $L$ is algebraic over $k(B')$. In particular, $b_{i+1}$ is algebraic over $k(B')$, so there exists a non-zero polynomial relation $f(b_{i+1}, b'_{j_1}, \ldots, b'_{j_r}) = 0$ with coefficients in $k$, for some elements $b'_{j_1}, \ldots, b'_{j_r} \in B'$. At least one of these $b'_{j_\ell}$ must be different from $b'_1, \ldots, b'_i$: otherwise $b_{i+1}$ would be algebraic over $k(b'_1, \ldots, b'_i)$, hence algebraic over $k(b'_1, \ldots, b'_i, b_{i+2}, \ldots, b_n)$. But then $L$, being algebraic over $k(b'_1, \ldots, b'_i, b_{i+1}, \ldots, b_n)$, would be algebraic over $k(b'_1, \ldots, b'_i, b_{i+2}, \ldots, b_n)$ (since algebraic extensions compose). This set has $n - 1$ elements, and $B$ has $n$ algebraically independent elements over $k$ that would all be algebraic over a set of $n - 1$ elements. This contradicts the algebraic independence of $B$ (by a standard argument: if $b_1, \ldots, b_n$ are algebraically independent over $k$ and all algebraic over $k(c_1, \ldots, c_{n-1})$, an exchange argument gives a contradiction).
Choose such a $b'_{j_\ell} \in B' \setminus \{b'_1, \ldots, b'_i\}$ and call it $b'_{i+1}$. The polynomial relation shows $b_{i+1}$ is algebraic over $k(b'_1, \ldots, b'_{i+1}, b'_{j_1}, \ldots) \supset k(b'_1, \ldots, b'_{i+1})$, but more importantly $b'_{i+1}$ actually appears in the relation, so $b'_{i+1}$ is algebraic over $k(b_{i+1}, b'_1, \ldots, b'_i, \text{other } b'\text{'s})$, which is algebraic over $k(b'_1, \ldots, b'_i, b_{i+1}, \ldots, b_n)$. Since $L$ is algebraic over $k(b'_1, \ldots, b'_i, b_{i+1}, \ldots, b_n)$, and replacing $b_{i+1}$ by $b'_{i+1}$ preserves the property that $L$ is algebraic over the resulting set (because $b_{i+1}$ is algebraic over $k(b'_1, \ldots, b'_{i+1}, b_{i+2}, \ldots, b_n)$), the set $\{b'_1, \ldots, b'_{i+1}, b_{i+2}, \ldots, b_n\}$ still has $L$ algebraic over $k$ applied to it.
We must also verify algebraic independence: the set $\{b'_1, \ldots, b'_{i+1}, b_{i+2}, \ldots, b_n\}$ has $n$ elements, and $L$ is algebraic over it, so if it were algebraically dependent, a transcendence basis inside it would have fewer than $n$ elements. But $B = \{b_1, \ldots, b_n\}$ is algebraically independent over $k$, each $b_j$ is algebraic over $k(b'_1, \ldots, b'_{i+1}, b_{i+2}, \ldots, b_n)$, so $\operatorname{trdeg}_k L \geq n$. Hence the set must be algebraically independent and is a transcendence basis.
After $n$ steps, $\{b'_1, \ldots, b'_n\} \subset B'$ is a transcendence basis for $L/k$. Since $B'$ is algebraically independent, every element of $B'$ is algebraic over $k(b'_1, \ldots, b'_n)$. But algebraic independence of $B'$ implies that the only elements of $B'$ algebraic over $k(b'_1, \ldots, b'_n)$ are those in $\{b'_1, \ldots, b'_n\}$ itself, so $B' = \{b'_1, \ldots, b'_n\}$ and $|B'| = n = |B|$.
For the case where both $B$ and $B'$ are infinite, a symmetric exchange argument using the axiom of choice shows $|B| \leq |B'|$ and $|B'| \leq |B|$, giving $|B| = |B'|$ by the Cantor-Bernstein theorem.[/step]