Exhibit 23.1

CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM

We consent to the incorporation by reference in the Registration Statement (Form S-8, Nos. 333-172166 and 333-167752) pertaining to 2002 Stock Plan, as amended, and 2010 Equity Incentive Award Plan of Codexis, Inc. of our reports dated March 5, 2012, with respect to the consolidated financial statements of Codexis, Inc. and the effectiveness of internal control over financial reporting of Codexis, Inc. included in this Annual Report (Form 10-K) for the year ended December 31, 2011.

/s/ Ernst & Young LLP

Redwood City, California

March 5, 2012