Genes are primarily located within the nucleus of a cell. The nucleus is the cellular compartment that contains the chromosomes and acts as the control center for cellular activity.
Genes are mostly contained in the nucleus, although some are also found in organelles called mitochondria and chloroplasts.