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

    <schemaVersion>X0609</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2026-08-19</periodOfReport>

    <issuer>
        <issuerCik>0001767042</issuerCik>
        <issuerName>Kodiak Gas Services, Inc.</issuerName>
        <issuerTradingSymbol>KGS</issuerTradingSymbol>
        <issuerForeignTradingSymbol></issuerForeignTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001971122</rptOwnerCik>
            <rptOwnerName>McKee Robert Michael</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerNonUSAddressFlag>false</rptOwnerNonUSAddressFlag>
            <rptOwnerStreet1>9950 WOODLOCH FOREST DRIVE</rptOwnerStreet1>
            <rptOwnerStreet2>SUITE 1900</rptOwnerStreet2>
            <rptOwnerCity>THE WOODLANDS</rptOwnerCity>
            <rptOwnerState>TX</rptOwnerState>
            <rptOwnerZipCode>77380</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>true</isDirector>
            <isOfficer>true</isOfficer>
            <isTenPercentOwner>false</isTenPercentOwner>
            <isOther>false</isOther>
            <officerTitle>President &amp; CEO</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>true</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
                <footnoteId id="F1"/>
            </securityTitle>
            <transactionDate>
                <value>2026-08-19</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>false</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>6008</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>62.3887</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>298589</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock</value>
                <footnoteId id="F2"/>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>16180</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>By StarMac Investments, Ltd.</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">This transaction is pursuant to a 10b5-1 trading plan adopted May 19, 2026. The price reported is a weighted average sale price. These shares were sold in multiple transactions at prices ranging from $61.79 per share to $63.20 per share, inclusive. The reporting person undertakes to provide to Kodiak Gas Services, Inc., any security holder of Kodiak Gas Services, Inc., or the staff of the Securities and Exchange Commission, upon request, full information regarding the number of shares sold at each separate price within the range set forth in this footnote.</footnote>
        <footnote id="F2">These shares of common stock are held by StarMac Investments, Ltd. Mr. McKee is a manager of StarMac Management Co., LLC, the general partner of StarMac Investments, Ltd.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Jennifer LeGrand Howard, attorney-in-fact</signatureName>
        <signatureDate>2026-08-20</signatureDate>
    </ownerSignature>
</ownershipDocument>
