The most common cause of deaths due to cancers nowadays is lung cancer. The objective of this study was to prepare erlotinib loaded chitosan nanoparticles for their anticancer potential. To study the effect of formulation variables on prepared nanoparticles using central composite design. Erlotinib loaded chitosan nanoparticles were prepared by ionic gelation method using probe sonication technique. It was found that batch NP-7 has a maximum loading capacity and entrapment efficiency with a particle size (138.5 nm) which is ideal for targeting solid tumors. Analysis of variance was applied to the particle size, entrapment efficiency and percent cumulative drug release to study the fitting and the significance of the model. The batch NP-7 showed 91.57% and 39.78% drug release after 24 h in 0.1 N hydrochloric acid and Phosphate Buffer (PB) pH 6.8, respectively. The IC50 value of NP-7 evaluated on A549 Lung cancer cells was found to be 6.36 μM. The XRD of NP-7 displayed the existence of erlotinib in the amorphous pattern. The optimized batch released erlotinib slowly in comparison to the marketed tablet formulation. Erlotinib loaded chitosan nanoparticles were prepared successfully using sonication technique with suitable particle size, entrapment efficiency and drug release. The formulated nanoparticles can be utilized for the treatment of lung cancer.