The presence, genetic identity and diversity of algal endosymbionts (Symbiodinium) in 114 species from 69 genera (20 families) of octocorals from the Great Barrier Reef (GBR), the far eastern Pacific (EP) and the Caribbean was examined, and patterns of the octocoral–algal symbiosis were compared with patterns in the host phylogeny. Genetic analyses of the zooxanthellae were based on ribosomal DNA internal transcribed spacer 1 (ITS1) region. In the GBR samples, Symbiodinium clades A and G were encountered with A and G being rare. Clade B zooxanthellae have been previously reported from a GBR octocoral, but are also rare in octocorals from this region. Symbiodinium G has so far only been found in Foraminifera, but is rare in these organisms. In the Caribbean samples, only Symbiodinium clades B and C are present. Hence, Symbiodinium diversity at the level of phylogenetic clades is lower in octocorals from the Caribbean compared to those from the GBR. However, an unprecedented level of ITS1 diversity was observed within individual colonies of some Caribbean gorgonians, implying either that these simultaneously harbour multiple strains of clade B zooxanthellae, or that ITS1 heterogeneity exists within the genomes of some zooxanthellae. Intracladal diversity based on ITS should therefore be interpreted with caution, especially in cases where no independent evidence exists to support distinctiveness, such as ecological distribution or physiological characteristics. All samples from EP are azooxanthellate. Three unrelated GBR taxa that are described in the literature as azooxanthellate (Junceella fragilis, Euplexaura nuttingi and Stereonephthya sp. 1) contain clade G zooxanthellae, and their symbiotic association with zooxanthellae was confirmed by histology. These corals are pale in colour, whereas related azooxanthellate species are brightly coloured. The evolutionary loss or gain of zooxanthellae may have altered the light sensitivity of the host tissues, requiring the animals to adopt or reduce pigmentation. Finally, we superimposed patterns of the octocoral–algal symbiosis onto a molecular phylogeny of the host. The data show that many losses/gains of endosymbiosis have occurred during the evolution of octocorals. The ancestral state (azooxanthellate or zooxanthellate) in octocorals remains unclear, but the data suggest that on an evolutionary timescale octocorals can switch more easily between mixotrophy and heterotrophy compared to scleractinian corals, which coincides with a low reliance on photosynthetic carbon gain in the former group of organisms.