The selective area etching of wurtzite GaN (0001) and AlGaN (0001) with SiO2 masks is investigated for different temperatures of 800 to 1 100°C and different ambient gases of H2, N2 and Ar including NH3. The etching rate of GaN increases with increasing annealing temperature under H2 ambient. This etching is attributed to the chemical reaction between Ga-N and H2. On the other hand, the etching of GaN does not occur in the N2 or Ar ambient gas. The NH3 gas in H2 ambient suppresses the chemical reaction, while the NH3 gas in N2 enhances it. The surface etching of Al0.1Ga0.9N is not observed even in H2 ambient.