To generalize for all squares, regardless of consecutive or distance apart. Sorry for formatting:

a^2-b^2 = (a+b) * (a-b)

26^2 - 24^2 = (26+24) * (26-24)
676 - 576 = 50 * 2

This specific situation is just the special case where a-b = 1