Defect-selective etching with molten Ba(OH)2/MgO etch drops was performed on c-plane AlGaN layers covering the entire composition range between GaN and AlN. Regardless of the aluminum content, the etchant produced shallow, hexagonal etch pits with depth-to-diameter ratios of 1/10–1/100. Two predominant types of etch pits were observed, which differed in size. In addition, the etch rate decreased from the center to the edge of the area exposed to the etch drops, providing a radially symmetric variation in etch pit size. For all AlGaN compositions, the positions of the etch pits correlate perfectly with the positions of the dark luminescence spots in cathodoluminescence measurements. Areas on the AlGaN samples that were not exposed to the etching procedure showed identical dark spots with the same size and density as those in the etched regions. Additionally, the density of etch pits and dark spots corresponded to the density of threading dislocations in the AlGaN layers. These observations demonstrate that the density of threading dislocations in c-plane AlGaN layers can be determined by destructive defect-selective etching with Ba(OH)2/MgO and etch pit counting, as well as by nondestructive counting of the dark spots in cathodoluminescence images.