A square matrix is diagonalizable if and only if its minimal polynomial is squarefree.
This needs a bit of explanation. The base field, the smallest field containing the entries of the matrix, may not contain all the roots of the minimal polynomial; for example, a real matrix and minimal $x^2 + 1.$ Furthermore, enlarging the field does not change the minimal polynomial. However, it may allow us to factor, as in $x^2 + 1 = (x-i)(x+i).$ Here we can see clearly that the two linear factors are distinct. Put another way, the roots of the minimal polynomial in any field extension are distinct.
By Cayley-Hamilton, we do not need to find roots to confirm the minimal polynomial, just find the lowest degree polynomial dividing the characteristic polynomial that annihilates the matrix.
See Proposition 2.8 and Examples 2.9 in Michael Stoll, on pages 5 and 6.