First, not all square roots are irrational. For example, #sqrt(9)# has the perfectly rational solution of #3#
Before we go on, let's review what it means to have an irrational number - it has to be a value that goes on forever in decimal form and is not a pattern, like #pi#. And since it has a never ending value that does not follow a pattern, it cannot be written as a fraction.
For example, #1/3# equals #0.33333333#, but because it repeats we can write it a as fraction
Let's get back to your question. Some square roots, like #sqrt(2)# or #sqrt(20# are irrational, since they cannot be simplified to a whole number like #sqrt(25)# can be. They go on forever without ever repeating, which means we can;t write it as a decimal without rounding and that we can't write it as a fraction for the same reason.
So, if a square root is not a perfect square, it is an irrational number