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

    <schemaVersion>X0206</schemaVersion>

    <documentType>3</documentType>

    <periodOfReport>2024-02-20</periodOfReport>

    <noSecuritiesOwned>0</noSecuritiesOwned>

    <issuer>
        <issuerCik>0001633931</issuerCik>
        <issuerName>TopBuild Corp</issuerName>
        <issuerTradingSymbol>BLD</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0002009481</rptOwnerCik>
            <rptOwnerName>KRESTANCIC JEFF M</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O TOPBUILD CORP.</rptOwnerStreet1>
            <rptOwnerStreet2>475 NORTH WILLIAMSON BOULEVARD</rptOwnerStreet2>
            <rptOwnerCity>DAYTONA BEACH</rptOwnerCity>
            <rptOwnerState>FL</rptOwnerState>
            <rptOwnerZipCode>32114</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>0</isDirector>
            <isOfficer>1</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
            <officerTitle>President, TruTeam</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>3690</value>
                    <footnoteId id="F1"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">522 time based shares granted on February 20, 2024 which vest in three equal annual installments beginning on or about the first anniversary of the grant, and 782 performance shares granted on February 20, 2024 in two equal tranches subject to different performance metrics which vest on or about the third anniversary of the grant pursuant to the achievement of such performance metrics ranging from 0% to 200%. 2,386 shares beneficially held prior to the Reporting Person becoming a Section 16 officer.</footnote>
    </footnotes>

    <remarks>Exhibit List: Exhibit 24.1 - Power of Attorney</remarks>

    <ownerSignature>
        <signatureName>/s/ Luis F. Machado, Attorney-in-Fact</signatureName>
        <signatureDate>2024-02-21</signatureDate>
    </ownerSignature>
</ownershipDocument>
