Motivated by a recent experiment that reported the successful synthesis of hexagonal (h) AlN [Tsipas et al., Appl. Phys. Lett. 103, 251605 (2013)], we investigate structural, electronic, and vibrational properties of bulk, bilayer, and monolayer structures of h-AlN by using first-principles calculations. We show that the hexagonal phase of the bulk h-AlN is a stable direct-band-gap semiconductor. The calculated phonon spectrum displays a rigid-layer shear mode at 274 cm −1 and an E g mode at 703 cm −1 , which are observable by Raman measurements. In addition, single-layer h-AlN is an indirect-band-gap semiconductor with a nonmagnetic ground state. For the bilayer structure, AA -type stacking is found to be the most favorable one, and interlayer interaction is strong. While N -layered h-AlN is an indirect-band-gap semiconductor for N = 1 − 9, we predict that thicker structures (N 10) have a direct band gap at the point. The number-of-layer-dependent band-gap transitions in h-AlN is interesting in that it is significantly different from the indirect-to-direct crossover obtained in the transition-metal dichalcogenides.