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

    <schemaVersion>X0609</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2026-11-10</periodOfReport>

    <issuer>
        <issuerCik>0000879635</issuerCik>
        <issuerName>MID PENN BANCORP INC</issuerName>
        <issuerTradingSymbol>MPB</issuerTradingSymbol>
        <issuerForeignTradingSymbol></issuerForeignTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001548007</rptOwnerCik>
            <rptOwnerName>NORCROSS PHILIP A</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerNonUSAddressFlag>false</rptOwnerNonUSAddressFlag>
            <rptOwnerStreet1>P.O. BOX 3189</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>PALM BEACH</rptOwnerCity>
            <rptOwnerState>FL</rptOwnerState>
            <rptOwnerZipCode>33480</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>false</isDirector>
            <isOfficer>false</isOfficer>
            <isTenPercentOwner>true</isTenPercentOwner>
            <isOther>false</isOther>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>false</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2026-11-10</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>P</transactionCode>
                <equitySwapInvolved>false</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>17228</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>34.9</value>
                    <footnoteId id="F1"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>2556535</value>
                    <footnoteId id="F3"/>
                    <footnoteId id="F4"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                    <footnoteId id="F3"/>
                    <footnoteId id="F4"/>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Through GAH Capital, LLC</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2026-11-11</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>P</transactionCode>
                <equitySwapInvolved>false</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>1900</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>34.73</value>
                    <footnoteId id="F2"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>2558435</value>
                    <footnoteId id="F3"/>
                    <footnoteId id="F4"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                    <footnoteId id="F3"/>
                    <footnoteId id="F4"/>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Through GAH Capital, LLC</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">This reported price is a weighted average price. The shares were purchased in multiple transactions within the range of $34.41 and $35.05. The Reporting Persons undertake to provide to the Issuer, any security holder of the Issuer or the staff of the Securities and Exchange Commission, upon request, full information regarding the number of shares purchased at each separate price within the range set forth in this footnote.</footnote>
        <footnote id="F2">This reported price is a weighted average price. The shares were purchased in multiple transactions within the range of $34.49 and $35.02. The Reporting Persons undertake to provide to the Issuer, any security holder of the Issuer or the staff of the Securities and Exchange Commission, upon request, full information regarding the number of shares purchased at each separate price within the range set forth in this footnote.</footnote>
        <footnote id="F3">Philip A. Norcross, GAH Capital, LLC and the GAH Capital Trust (together, the &quot;Reporting Persons&quot;) may be deemed to be members of a &quot;group&quot; for purposes of Section 13(d) of the Securities Exchange Act of 1934, as amended, that collectively beneficially owns 2,558,435 shares of Common Stock, or more than 10% of the outstanding shares of Common Stock. GAH Capital, LLC is a wholly owned subsidiary of the GAH Capital Trust. Philip A. Norcross serves as the Manager of GAH Capital, LLC and as a Trustee of the GAH Capital Trust, and the Trustees of the GAH Capital Trust have delegated to Mr. Norcross full investment authority and the full power to invest and dispose of trust property.</footnote>
        <footnote id="F4">(Continued from footnote 3) As a result, Mr. Norcross and the GAH Capital Trust may be deemed to indirectly beneficially own the shares held by GAH Capital, LLC. Mr. Norcross also holds 15,079 shares of Common Stock in his personal capacity. Philip A. Norcross is the designated filer. Each of the Reporting Persons (other than to the extent it directly holds securities) disclaims beneficial ownership of the Common Stock except to the extent of their pecuniary interest therein.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Philip A. Norcross</signatureName>
        <signatureDate>2026-11-16</signatureDate>
    </ownerSignature>
</ownershipDocument>
