There are a few ways that you can write 2 squared.
1.) 2^2. People will think of it as 2 squared.
2.) Use copy and paste. Just search from google.
3.) If you are using Microsoft Word, Just press the superscript button that is at the left part of the bold, italic, and underline buttons or press (Ctrl Shift +) simultaneously.