What a 2x2 photo is
A 2x2 photo is square: 2 inches by 2 inches, or 51 by 51 mm. It's the size the US Department of State requires for US passport photos, and the size used for US visa applications, such as the DS-160 for visitor visas.
This tool creates the photo at 300 DPI with 602 × 602 pixels, which prints at 2×2 inches at actual size. You can download just the photo or a sheet with several copies and optional cut lines. The sheet starts on Letter, where 15 copies fit; A4 also fits 15, and a 4×6 inch print fits 2.
The official requirements to meet
According to the Department of State, the photo must be in color, taken in the last 6 months, against a plain white or off-white background with no shadows, texture or objects. Face the camera directly with a neutral expression, both eyes open and mouth closed, with your head and shoulders centered. Glasses must come off, including sunglasses and tinted lenses, unless you can't remove them for medical reasons and include a signed note from your doctor.
Your head, measured from the bottom of the chin to the top of the head, must be between 1 and 1 3/8 inches, which is 25 to 35 mm. Inside this tool's square box that's roughly half to two thirds of the height: leave some space above your hair and let the top of your shoulders show.
Digital photo for the DS-160
For visas, the photo is uploaded with the online form. The Department of State asks for a square JPEG between 600 × 600 and 1200 × 1200 pixels, 240 kB or smaller. The single JPEG this page downloads is 602 × 602 pixels, inside that range.
The file size depends on the photo. If the form says it's too large, run it through Compress image in KB mode and set a target under 240 KB without changing the dimensions. If you need prints, for a passport application by mail or in person, print the sheet.
Taking the photo, and what the tool doesn't do
Stand a couple of feet in front of a white wall and have someone else take the photo at eye level, with soft, even light from the front so there are no shadows on your face or behind you. Skip the arm's-length selfie: it distorts your face. Leave room around you so you can frame it.
The tool doesn't change or whiten the background, doesn't retouch your face and doesn't check whether the photo meets every rule. The passport agency or consulate decides whether to accept it, so review their instructions before you submit.