By using the first-principle methods, we have investigated the adsorption of the CO, CO 2 , NO, and NH 3 molecules on an armchair graphene nanoribbon (AGNR). The optimal adsorption positions and orientations of these molecules on AGNR are determined. The adsorption energies, the charge transfer, and the density of states (DOS) are obtained. The NO, CO, and CO 2 adsorbed molecules act as an acceptor, and the NH 3 adsorbed molecule acts as a donor. The NO and CO molecules contributed with localized states in the center of the original band gap. But the system exhibits n-type or p-type semiconductor after NH 3 or CO 2 adsorption.