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

    <schemaVersion>X0609</schemaVersion>

    <documentType>4</documentType>

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

    <issuer>
        <issuerCik>0000352915</issuerCik>
        <issuerName>UNIVERSAL HEALTH SERVICES INC</issuerName>
        <issuerTradingSymbol>UHS</issuerTradingSymbol>
        <issuerForeignTradingSymbol></issuerForeignTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001181031</rptOwnerCik>
            <rptOwnerName>MILLER ALAN B</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerNonUSAddressFlag>false</rptOwnerNonUSAddressFlag>
            <rptOwnerStreet1>UNIVERSAL HEALTH SERVICES, INC.</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>KING OF PRUSSIA</rptOwnerCity>
            <rptOwnerState>PA</rptOwnerState>
            <rptOwnerZipCode>19406</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>1</isOfficer>
            <isTenPercentOwner>1</isTenPercentOwner>
            <officerTitle>Executive Chairman</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2026-03-19</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>F</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>1399</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>189.58</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>1783190</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2026-03-21</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>F</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>1177</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>185.82</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>1782013</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>55763</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>By The Abby Miller King
          2011 Family Trust</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>8623</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>The Alan and Jill Miller
          Foundation</value>
                    <footnoteId id="F1"/>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>59900</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>The Marc Daniel Miller
          2011 Family Trust</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>55763</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>The Marni Spencer 2011
          Family Trust</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>9418</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Abby Miller King 2024 GRAT</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>24295</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Abby Miller King 2025 GRAT</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>13963</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Marc Daniel Miller 2024 GRAT</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>24295</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Marc Daniel Miller 2025 GRAT</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>9418</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Marni Spencer 2024 GRAT</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>24295</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Marni Spencer 2025 GRAT</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">Mr. Alan B. Miller disclaims beneficial ownership of these securities, and this report shall not be deemed an admission that Mr. Alan B. Miller is the beneficial owner of these securities for purposes of Section 16 or for any other purpose.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Steve Filton, Attorney-in-Fact for Alan B. Miller</signatureName>
        <signatureDate>2026-03-23</signatureDate>
    </ownerSignature>
</ownershipDocument>
