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

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2025-05-14</periodOfReport>

    <issuer>
        <issuerCik>0000944695</issuerCik>
        <issuerName>HANOVER INSURANCE GROUP, INC.</issuerName>
        <issuerTradingSymbol>THG</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001584240</rptOwnerCik>
            <rptOwnerName>Egan Cynthia</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O THE HANOVER INSURANCE GROUP, INC.</rptOwnerStreet1>
            <rptOwnerStreet2>440 LINCOLN STREET</rptOwnerStreet2>
            <rptOwnerCity>WORCESTER</rptOwnerCity>
            <rptOwnerState>MA</rptOwnerState>
            <rptOwnerZipCode>01653</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-05-14</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
                <footnoteId id="F1"/>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>977</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>977</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                    <footnoteId id="F2"/>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Deferral Agreement</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">Shares granted pursuant to the Issuer's 2022 Long-Term Incentive Plan.</footnote>
        <footnote id="F2">Does not include 12,759 shares held directly by the Reporting Person.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Lindsay L. Katz pursuant to Confirming Statement</signatureName>
        <signatureDate>2025-05-15</signatureDate>
    </ownerSignature>
</ownershipDocument>
