A method is described for automatically detecting the optical axis using a genetic algorithm. The genetic approach was used to develop a basic model for automatically determining the parameters needed to adjust the optical axis. Application of this method to a model with two axes demonstrated that it is as accurate the conventional manual method.