Formation of infectious HIV particles is directed by the viral Gag polyprotein and occurs at the plasma membrane of the producer cell. Gag initially assembles into an immature capsid shell structured as a truncated sphere consisting of regular hexameric subunits and irregular defects. This stable capsid structure corresponds to the production mode, while Gag proteolysis by the viral protease inside the complete virion converts the structure into the infection mode. Release of the CA domain from the polyprotein leads to disassembly of the immature shell and formation of the cone-shaped mature capsid, exhibiting a fullerene-geometry consisting of CA hexamers and pentamers. Recent cryo electron microscopy analyses have yielded unprecedented details of the structures of both the immature and the mature virion, and provided new insights into capsid function and inhibition.