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

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2024-03-01</periodOfReport>

    <issuer>
        <issuerCik>0000915912</issuerCik>
        <issuerName>AVALONBAY COMMUNITIES INC</issuerName>
        <issuerTradingSymbol>AVB</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001219700</rptOwnerCik>
            <rptOwnerName>NAUGHTON TIMOTHY J</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O AVALONBAY COMMUNITIES, INC.</rptOwnerStreet1>
            <rptOwnerStreet2>4040 WILSON BOULEVARD STE 1000</rptOwnerStreet2>
            <rptOwnerCity>ARLINGTON</rptOwnerCity>
            <rptOwnerState>VA</rptOwnerState>
            <rptOwnerZipCode>22203</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>true</isDirector>
            <isOfficer>false</isOfficer>
            <isTenPercentOwner>false</isTenPercentOwner>
            <isOther>false</isOther>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>false</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common Stock, par value $.01 per share</value>
            </securityTitle>
            <transactionDate>
                <value>2024-03-01</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>F</transactionCode>
                <equitySwapInvolved>false</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>22200</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>55123.6154</value>
                    <footnoteId id="F2"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock, par value $.01 per share</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>89073</value>
                    <footnoteId id="F3"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>By GRAT</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Common Stock, par value $.01 per share</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>14024</value>
                    <footnoteId id="F4"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>By Family Trust</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">Reflects withholding of shares by the Company to cover tax withholding obligations on the vesting of restricted stock and performance share unit awards under the Company's Second Amended and Restated 2009 Equity Incentive Plan.</footnote>
        <footnote id="F2">The amount of securities owned following the reported transaction reflects direct ownership of all shares of common stock, including restricted shares and deferred stock units, some of which may be subject to vesting requirements.</footnote>
        <footnote id="F3">No transaction is reported. The amount of securities owned indirectly following the reported transaction is included for informational purposes only.</footnote>
        <footnote id="F4">No transaction is reported. Reflects indirect beneficial ownership by spouse through Family Trust and the reporting person disclaims any beneficial ownership in these shares.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>Edward M. Schulman, as attorney-in-fact under Power of Attorney dated January 1, 2000</signatureName>
        <signatureDate>2024-03-05</signatureDate>
    </ownerSignature>
</ownershipDocument>
