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

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2026-03-03</periodOfReport>

    <issuer>
        <issuerCik>0000077360</issuerCik>
        <issuerName>PENTAIR plc</issuerName>
        <issuerTradingSymbol>PNR</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0002068707</rptOwnerCik>
            <rptOwnerName>Hensley Jennifer M</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>5500 WAYZATA BOULEVARD</rptOwnerStreet1>
            <rptOwnerStreet2>SUITE 900</rptOwnerStreet2>
            <rptOwnerCity>GOLDEN VALLEY</rptOwnerCity>
            <rptOwnerState>MN</rptOwnerState>
            <rptOwnerZipCode>55416</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>false</isDirector>
            <isOfficer>true</isOfficer>
            <isTenPercentOwner>false</isTenPercentOwner>
            <isOther>false</isOther>
            <officerTitle>SVP, CAO &amp; Controller</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>false</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Shares</value>
            </securityTitle>
            <transactionDate>
                <value>2026-03-03</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>F</transactionCode>
                <equitySwapInvolved>false</equitySwapInvolved>
                <footnoteId id="F1"/>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>132</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>97.57</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>3072.7285</value>
                    <footnoteId id="F2"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Shares - Restricted Stock Units</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>2502.9030</value>
                    <footnoteId id="F2"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">Shares surrendered to pay taxes applicable to vesting of restricted stock units.</footnote>
        <footnote id="F2">End-of-period holdings reflect the vesting of restricted stock units that were previously reported.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ John K. Wilson, Attorney-in-Fact for Jennifer M. Hensley</signatureName>
        <signatureDate>2026-03-05</signatureDate>
    </ownerSignature>
</ownershipDocument>
