Heterocytous cyanobacteria are important players in the carbon and nitrogen cycle. They can fix dinitrogen by using heterocytes, specialized cells containing the oxygen-sensitive nitrogenase enzyme surrounded by a thick polysaccharide and glycolipid layer which prevents oxygen diffusion and nitrogenase inactivation. Heterocyte glycolipids can be used to detect the presence of heterocytous cyanobacteria in present-day and past environments, providing insight into the functioning of the studied ecosystems. However, due to their good preservation throughout time, heterocyte glycolipids are not ideal to detect and study living communities, instead methods based on DNA are preferred. Currently cyanobacteria can be detected using untargeted genomic approaches such as metagenomics, or they can be specifically targeted by, for example, the use of primers that preferentially amplify their 16S rRNA gene or their nifH gene in the case of nitrogen fixing cyanobacteria. However, since not all cyanobacterial nitrogen fixers are heterocytous, there is currently no fast gene-based method to specifically detect and distinguish heterocytous cyanobacteria. Here, we developed a PCR-based method to specifically detect heterocytous cyanobacteria by designing primers targeting the gene (hglT) encoding the enzyme responsible for the last step in the biosynthesis of heterocyte glycolipid (i.e., a glycosyltransferase). We designed several primer sets using the publicly available sequences of 23 heterocytous cyanobacteria, after testing them on DNA extracts of 21 heterocyte-forming and 7 non-heterocyte forming freshwater cyanobacteria. The best primer set was chosen and successfully used to confirm the presence of heterocytous cyanobacteria in a marine environmental sample.