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

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2025-04-02</periodOfReport>

    <notSubjectToSection16>1</notSubjectToSection16>

    <issuer>
        <issuerCik>0001447051</issuerCik>
        <issuerName>Territorial Bancorp Inc.</issuerName>
        <issuerTradingSymbol>TBNK</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001467593</rptOwnerCik>
            <rptOwnerName>Caldwell Kirk W</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>PAUAHI TOWER, 1003 BISHOP STREET</rptOwnerStreet1>
            <rptOwnerStreet2>SUITE 500</rptOwnerStreet2>
            <rptOwnerCity>HONOLULU</rptOwnerCity>
            <rptOwnerState>HI</rptOwnerState>
            <rptOwnerZipCode>96813</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2025-04-02</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>D</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>34227</value>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F1"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>0</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">Pursuant to a merger agreement between the Issuer and Hope Bancorp, Inc., each issued and outstanding share of Issuer common stock was converted into the right to receive 0.8048 shares of Hope Bancorp, Inc. common stock (subject to the payment of cash in lieu of fractional shares).</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Ned A. Quint, pursuant to power of attorney</signatureName>
        <signatureDate>2025-04-02</signatureDate>
    </ownerSignature>
</ownershipDocument>
