The APOBEC family members are involved in diverse biological functions. APOBEC3G restricts the replication of human immunodeficiency virus (HIV), hepatitis B virus and retroelements by cytidine deamination on single-stranded DNA or by RNA binding. Here we report the high-resolution crystal structure of the carboxy-terminal deaminase domain of APOBEC3G (APOBEC3G-CD2) purified from Escherichia coli. The APOBEC3G-CD2 structure has a five-stranded beta-sheet core that is common to all known deaminase structures and closely resembles the structure of another APOBEC protein, APOBEC2 (ref. 5). A comparison of APOBEC3G-CD2 with other deaminase structures shows a structural conservation of the active-site loops that are directly involved in substrate binding. In the X-ray structure, these APOBEC3G active-site loops form a continuous 'substrate groove' around the active centre. The orientation of this putative substrate groove differs markedly (by 90 degrees) from the groove predicted by the NMR structure. We have introduced mutations around the groove, and have identified residues involved in substrate specificity, single-stranded DNA binding and deaminase activity. These results provide a basis for understanding the underlying mechanisms of substrate specificity for the APOBEC family.