Face detection and recognition has been introduced in many real world applications. Several algorithms have been implemented for either detection or recognition. In this paper, a novel algorithm, which simultaneously detects and recognizes facial images employing the same method, is presented. The proposed algorithm is based on a new 2D representation for the Histogram of Oriented Gradients (2D-HOG) in conjunction with 2DPCA for feature extraction. Experimental results conducted on existing datasets, FERET, ORL, UMIST, JAFFE, and MIT-CMU, achieved better accuracy and running time compared with