The rules most countries share
Almost every country asks for a recent, sharp, front-facing colour photo with a plain background, a neutral expression, both eyes open and no shadows on the face. Hats and head coverings are normally not allowed unless worn for religious or medical reasons, and then the full face must still be visible.
Size and head height
The photo size differs by country, for example 2 × 2 inch (US), 35 × 45 mm (UK, Australia, much of Europe) or 50 × 70 mm (Canada). The head, from chin to crown, usually has to fill about 70 to 80 percent of the frame. See all sizes in cm, inches and pixels.
Background
Most countries want plain white, off-white or light grey with no pattern or shadow. Details by country are in the background colour guide.
Digital photos for online applications
Online systems usually want a JPG with a minimum number of pixels and a maximum file size. Make the photo with the passport photo maker and reduce the file with the 200KB tool if needed.
Always check the official page
Rules change and each office has its own checks. PicFitter crops and sizes your photo but cannot guarantee acceptance, so confirm on your government site.