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

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2025-11-05</periodOfReport>

    <notSubjectToSection16>0</notSubjectToSection16>

    <issuer>
        <issuerCik>0001050915</issuerCik>
        <issuerName>QUANTA SERVICES, INC.</issuerName>
        <issuerTradingSymbol>PWR</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001229832</rptOwnerCik>
            <rptOwnerName>JACKMAN WORTHING</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>2727 NORTH LOOP WEST</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>HOUSTON</rptOwnerCity>
            <rptOwnerState>TX</rptOwnerState>
            <rptOwnerZipCode>77008-1044</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>0</isOfficer>
            <isTenPercentOwner>0</isTenPercentOwner>
            <isOther>0</isOther>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2025-11-05</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>6349</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>450.45</value>
                    <footnoteId id="F1"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>2730</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2025-11-05</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>G</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>800</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>1930</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeHolding>
            <securityTitle>
                <value>Restricted Stock Units</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>0</value>
                <footnoteId id="F2"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F3"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F3"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>11048</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>11048</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">The price reported in Column 4 is a weighted average price. These shares were sold in multiple transactions at prices ranging from $450.41 to $450.74. The reporting person undertakes to provide to Quanta Services, Inc., any security holder of Quanta 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 ranges set forth in this footnote.</footnote>
        <footnote id="F2">The restricted stock units are settled in shares of common stock on a one-for-one basis, provided that in certain circumstances the reporting person may elect to settle up to 50% of the restricted stock units in cash.</footnote>
        <footnote id="F3">Includes unvested restricted stock units and vested restricted stock units for which settlement has been deferred by the reporting person pursuant to the terms of a nonqualified deferred compensation plan maintained by the Company. Unless otherwise provided in the award agreement, the restricted stock units vest and settle on June 1, 2026. Settlement of all or a portion of the restricted stock units may be deferred by the reporting person pursuant to the terms of a nonqualified deferred compensation plan maintained by the Company.</footnote>
    </footnotes>

    <remarks>Please see filings made under CIK 0001328708 for prior filings made for the Reporting Person with respect to Quanta Services, Inc. securities. Previously, the Reporting Person was inadvertently issued two sets of EDGAR access codes. Going forward, the Reporting Person will make all filings using this CIK 0001229832.</remarks>

    <ownerSignature>
        <signatureName>/s/ Jessica L. Sherman, Attorney-in-Fact</signatureName>
        <signatureDate>2025-11-07</signatureDate>
    </ownerSignature>
</ownershipDocument>
