The acidity of phenols is due to the greater resonance stabilization of the phenoxide ion relative to phenol. Therefore, electron withdrawing groups (EWG) like −NO2 which stabilize the phenoxide ion more by dispersing the negative charge will tend to increase the acidity of phenols.
On the other hand, electron donating groups (EDG) like-alkyl group destabilize the phenoxide ion by intensifying the negative charge relative to phenol tend to decrease the acidic strength of phenols.
As methyl group has +l effect and it is stronger at o-position than at p -position, (+1 effect decreases with distance )o -cresol is a weaker acid than p-cresol.