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

    <schemaVersion>X0306</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2022-03-23</periodOfReport>

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

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001788925</rptOwnerCik>
            <rptOwnerName>Peterson Matthew Jay</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>367 SOUTH GULPH ROAD</rptOwnerStreet1>
            <rptOwnerStreet2></rptOwnerStreet2>
            <rptOwnerCity>KING OF PRUSSIA</rptOwnerCity>
            <rptOwnerState>PA</rptOwnerState>
            <rptOwnerZipCode>19406</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isOfficer>1</isOfficer>
            <officerTitle>Executive Vice President, UHS</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeHolding>
            <securityTitle>
                <value>Class B Common Stock</value>
            </securityTitle>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>245.7037</value>
                    <footnoteId id="F1"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeHolding>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeTransaction>
            <securityTitle>
                <value>Option To Purchase Class B Common Stock</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>143.81</value>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2022-03-23</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
                <footnoteId id="F2"/>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>21745</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>143.81</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <footnoteId id="F3"/>
            </exerciseDate>
            <expirationDate>
                <value>2027-03-22</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class B Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>21745</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>21745</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">22.764 Class B shares purchased on July 14, 2021 at a discounted rate of $131.7870, 24.09 Class B shares purchased on October 13, 2021 at a discounted rate of $124.5330, and 25.7083 Class B shares purchased on January 13, 2022 at a discounted rate of $116.6940 pursuant to the Universal Health Services 2005 Employee Stock Purchase Plan.</footnote>
        <footnote id="F2">Option granted to purchase shares of Class B Common Stock under the Company's Amended and Restated 2020 Omnibus Stock and Incentive Plan.</footnote>
        <footnote id="F3">Options vest ratably on each of 3/23/2023, 3/23/2024, 3/23/2025, and 3/23/2026.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Steve Filton, Attorney-in-Fact for Mr. Peterson</signatureName>
        <signatureDate>2022-03-25</signatureDate>
    </ownerSignature>
</ownershipDocument>
