<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2025-06-10</periodOfReport>

    <issuer>
        <issuerCik>0001200375</issuerCik>
        <issuerName>CODEXIS, INC.</issuerName>
        <issuerTradingSymbol>CDXS</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0002043287</rptOwnerCik>
            <rptOwnerName>De Vre Raymond</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O CODEXIS, INC.</rptOwnerStreet1>
            <rptOwnerStreet2>200 PENOBSCOT DRIVE</rptOwnerStreet2>
            <rptOwnerCity>REDWOOD CITY</rptOwnerCity>
            <rptOwnerState>CA</rptOwnerState>
            <rptOwnerZipCode>94063</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>true</isDirector>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>false</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2025-06-10</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>40983</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>88829</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">The restricted stock units vest as to all of the shares subject to the award on the earlier of the first anniversary of the date of grant or the next annual stockholder meeting, subject to the director's continued service to the Company on such vesting date.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Georgia Erbez, as Attorney-in-Fact for Raymond De Vre</signatureName>
        <signatureDate>2025-06-12</signatureDate>
    </ownerSignature>
</ownershipDocument>
