I will use the language of modules.
A choice of linear operator $A$ on a vector space $V$ is equivalent to making $V$ a $\mathbb{C}[T]$-module, where $T$ acts by the operator $A$. Since $\mathbb{C}[T]$ is a PID, the fundamental theorem of finitely-generated modules over PIDs applies, so we can say $V$ is isomorphic as a $\mathbb{C}[T]$-module to a direct sum of cyclic submodules, and cyclic modules (by Chinese Remainder Theorem) are WLOG of the form $\mathbb{C}[T]/(T-\lambda)^d$. If we write the matrix for multiplication-by-$T$ on such a module with respect to the power basis $\{1,T,\cdots,T^{d-1}\}$ we get the $d\times d$ Jordan block associated to the generalized eigenvalue $\lambda$. The component containing all direct summands (or equivalently all cyclic submodules) with a given value of $\lambda$ forms the generalized eigenspace of $V$ associated to $\lambda$.
The centralizer of $A$ corresponds to finding the endomorphisms of $V$ as a $\mathbb{C}[T]$-module.
Note that $\hom$ is distributive, any element of $\hom(\bigoplus V_i,\bigoplus V_j)$ may be written as a matrix whose $ij$-entry is a homomorphism $V_i\to V_j$. Thus, to find the module endomorphisms of $V$, we simply need to determine all possible module homomorphisms $\mathbb{C}[T]/(T-\lambda)^d\to \mathbb{C}[T]/(T-\mu)^k$. Such a map is $T$-equivariant and its range is the cyclic submodule generated by the image of $1$. The only condition is that $1$ must be sent to an element annihilated by $(T-\lambda)^d$. Either $k\le d$ or this means $1$ is sent to something in the cyclic submodule $(T-\lambda)^{k-d}$ which has dimension $d$ within $(T-\lambda)^k$. Thus, the vector space of module homomorphisms is $\min\{d,k\}$ if $\lambda=\mu$, else $0$.
So if the Jordan blocks associated to $\lambda$ have sizes $d_1\ge d_2\ge\cdots\ge d_n$ then the dimension of the endomorphism algebra / centralizer is $\sum_{i,j}\min\{d_i,d_j\}$ which is the sum of terms in the array
$$ \begin{array}{cccc}
d_1 & d_2 & \cdots & d_n \\
d_2 & d_2 & \cdots & d_n \\
\vdots & \vdots & \ddots & \vdots \\
d_n & d_n & \cdots & d_n
\end{array} $$
which equals $\sum_{j=1}^n (2j-1)d_j$.
In general, we take this sum for each generalized eigenvalue $\lambda$ and combine.
To describe the centralizer / endomorphism algebra as an algebra, first decompose it as a direct sum of subalgebras associated to each $\lambda$, then write elements of these subalgebras as matrices whose entries are elements of quotient modules $(T-\lambda)^{k-d}/(T-\lambda)^k$ (interpreting $k-d$ as $0$ if $k\le d$) for the various choices of $d$ and $k$.
Here is an example. Consider a matrix with Jordan decomposition
$$ \color{Red}{J_1(0)\oplus J_1(0)\oplus J_2(0)}\oplus \color{Green}{J_3(i)\oplus J_4(i)} \oplus \color{Blue}{J_5(\omega)} $$
- Associated to $\color{Red}{\lambda=0}$ is $2\ge1\ge1$ with sum $\sum_{j=1}^3 (2j-1)d_j=(1)2+(3)1+(5)1=\color{Red}{10}$.
- Associated to $\color{Green}{\lambda=i}$ is $4\ge3$ with sum $\sum_{j=1}^2(2j-1)d_j= (1)4+(3)3=\color{Green}{13}$.
- Associated to $\color{Blue}{\lambda=\omega}$ is $5$ with sum $\sum_{j=1}^1 (2j-1)d_j=(1)5=\color{Blue}{5}$.
Thus the full centralizer has dimension $\color{Red}{10}+\color{Green}{13}+\color{Blue}{5}=28$.