We study the gauge invariance of laser-matter interaction. The velocity gauge where the vector potential is expanded to the $n$-th order with respect to the spatial coordinate, and the length gauge where the electric and magnetic fields are expanded to the $n$-th and $(n-1)$-th orders, respectively, are mutually gauge-transformed, describing the physically equivalent situation. The latter includes up to the electric $2^{n+1}$-pole and magnetic $2^n$-pole interactions as well as two extra terms. The finding serves to develop consistent nonperturbative simulation methods beyond the electric dipole approximation.