<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xmlns="http://www.xbrl.org/2003/instance"
  xmlns:dei="http://xbrl.sec.gov/dei/2026"
  xmlns:ffd="http://xbrl.sec.gov/ffd/2026"
  xmlns:iso4217="http://www.xbrl.org/2003/iso4217"
  xmlns:link="http://www.xbrl.org/2003/linkbase"
  xmlns:xbrldi="http://xbrl.org/2006/xbrldi"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <link:schemaRef
      xlink:href="https://xbrl.sec.gov/ffd/2026/ffd-2026.xsd"
      xlink:type="simple"/>
    <context id="rc">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0000352915</identifier>
        </entity>
        <period>
            <startDate>2026-08-17</startDate>
            <endDate>2026-08-17</endDate>
        </period>
    </context>
    <context id="offrl_1">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0000352915</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>1</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-08-17</startDate>
            <endDate>2026-08-17</endDate>
        </period>
    </context>
    <context id="offrl_2">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0000352915</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>2</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-08-17</startDate>
            <endDate>2026-08-17</endDate>
        </period>
    </context>
    <unit id="USD">
        <measure>iso4217:USD</measure>
    </unit>
    <unit id="pure">
        <measure>pure</measure>
    </unit>
    <unit id="Shares">
        <measure>shares</measure>
    </unit>
    <ffd:FormTp contextRef="rc" id="ixv-189">S-8</ffd:FormTp>
    <ffd:SubmissnTp contextRef="rc" id="ixv-190">S-8</ffd:SubmissnTp>
    <ffd:FeeExhibitTp contextRef="rc" id="ixv-191">EX-FILING FEES</ffd:FeeExhibitTp>
    <dei:EntityCentralIndexKey contextRef="rc" id="ixv-192">0000352915</dei:EntityCentralIndexKey>
    <dei:EntityRegistrantName contextRef="rc" id="ixv-193">UNIVERSAL HEALTH SERVICES INC</dei:EntityRegistrantName>
    <ffd:OfferingTableNa contextRef="rc" id="hiddenrcOfferingTableNa" xsi:nil="true"/>
    <ffd:OffsetTableNa contextRef="rc" id="hiddenrcOffsetTableNa">N/A</ffd:OffsetTableNa>
    <ffd:PrevslyPdFlg contextRef="offrl_1" id="ixv-196">false</ffd:PrevslyPdFlg>
    <ffd:PrevslyPdFlg contextRef="offrl_2" id="ixv-197">false</ffd:PrevslyPdFlg>
    <ffd:FormTp contextRef="rc" id="ixv-231">S-8</ffd:FormTp>
    <dei:EntityRegistrantName contextRef="rc" id="ixv-232">UNIVERSAL HEALTH SERVICES INC</dei:EntityRegistrantName>
    <ffd:OfferingSctyTp contextRef="offrl_1" id="ixv-233">Equity</ffd:OfferingSctyTp>
    <ffd:OfferingSctyTitl contextRef="offrl_1" id="ixv-234">Class B Common Stock, par value $0.01 per share, issuable in respect of assumed outstanding awards of unvested stock options under the Talkspace, Inc. 2021 Incentive Award Plan, as amended</ffd:OfferingSctyTitl>
    <ffd:FeesOthrRuleFlg contextRef="offrl_1" id="ixv-235">true</ffd:FeesOthrRuleFlg>
    <ffd:AmtSctiesRegd
      contextRef="offrl_1"
      decimals="0"
      id="ixv-236"
      unitRef="Shares">9214</ffd:AmtSctiesRegd>
    <ffd:MaxOfferingPricPerScty
      contextRef="offrl_1"
      decimals="2"
      id="ixv-237"
      unitRef="USD">85.00</ffd:MaxOfferingPricPerScty>
    <ffd:MaxAggtOfferingPric
      contextRef="offrl_1"
      decimals="2"
      id="ixv-238"
      unitRef="USD">783190.00</ffd:MaxAggtOfferingPric>
    <ffd:FeeRate
      contextRef="offrl_1"
      decimals="7"
      id="ixv-239"
      unitRef="pure">0.0001381</ffd:FeeRate>
    <ffd:FeeAmt
      contextRef="offrl_1"
      decimals="2"
      id="ixv-240"
      unitRef="USD">108.16</ffd:FeeAmt>
    <ffd:OfferingSctyTp contextRef="offrl_2" id="ixv-241">Equity</ffd:OfferingSctyTp>
    <ffd:OfferingSctyTitl contextRef="offrl_2" id="ixv-242">Class B Common Stock, par value $0.01 per share, issuable in respect of assumed outstanding awards of unvested restricted stock units under the Talkspace, Inc. 2021 Incentive Award Plan, as amended</ffd:OfferingSctyTitl>
    <ffd:FeesOthrRuleFlg contextRef="offrl_2" id="ixv-243">true</ffd:FeesOthrRuleFlg>
    <ffd:AmtSctiesRegd
      contextRef="offrl_2"
      decimals="0"
      id="ixv-244"
      unitRef="Shares">146988</ffd:AmtSctiesRegd>
    <ffd:MaxOfferingPricPerScty
      contextRef="offrl_2"
      decimals="2"
      id="ixv-245"
      unitRef="USD">168.71</ffd:MaxOfferingPricPerScty>
    <ffd:MaxAggtOfferingPric
      contextRef="offrl_2"
      decimals="2"
      id="ixv-246"
      unitRef="USD">24798345.48</ffd:MaxAggtOfferingPric>
    <ffd:FeeRate
      contextRef="offrl_2"
      decimals="7"
      id="ixv-247"
      unitRef="pure">0.0001381</ffd:FeeRate>
    <ffd:FeeAmt
      contextRef="offrl_2"
      decimals="2"
      id="ixv-248"
      unitRef="USD">3424.65</ffd:FeeAmt>
    <ffd:TtlOfferingAmt contextRef="rc" decimals="2" id="ixv-249" unitRef="USD">25581535.48</ffd:TtlOfferingAmt>
    <ffd:TtlFeeAmt contextRef="rc" decimals="2" id="ixv-250" unitRef="USD">3532.81</ffd:TtlFeeAmt>
    <ffd:TtlOffsetAmt contextRef="rc" decimals="2" id="ixv-251" unitRef="USD">0.00</ffd:TtlOffsetAmt>
    <ffd:NetFeeAmt contextRef="rc" decimals="2" id="ixv-252" unitRef="USD">3532.81</ffd:NetFeeAmt>
    <ffd:OfferingNote contextRef="offrl_1" id="ixv-253">(1) This Registration Statement (the "Registration Statement") registers the issuance of Class B Common Stock, par value $0.01 per share ("Class B Common Stock"), of Universal Health Services, Inc. (the "Company" or the "Registrant") issuable pursuant to the outstanding awards of unvested stock options and unvested restricted stock units assumed by the Company as a result of the consummation on August 17, 2026 of the transaction contemplated by that certain Agreement and Plan of Merger, dated as of March 9, 2026, by and among the Company, UHS Merger Subsidiary, Inc., a Delaware corporation and indirect wholly owned subsidiary of the Company, and Talkspace, Inc. Pursuant to Rule 416(a) of the Securities Act of 1933, as amended (the "Securities Act"), this Registration Statement on Form S-8 also covers any additional securities of the Company that may be offered or become issuable under the Talkspace, Inc. 2021 Incentive Award Plan, as amended (the "Talkspace Plan"), in connection with any stock split, stock dividend, recapitalization, or any other similar transaction effected without receipt of consideration, which results in an increase in the number of outstanding shares of Class B Common Stock. (2) Estimated solely for the purpose of calculating the registration fee pursuant to Rule 457(h) under the Securities Act. The offering price per share and aggregate offering price are based upon the weighted average exercise price for shares subject to the outstanding unvested options granted pursuant to the Talkspace Plan.</ffd:OfferingNote>
    <ffd:OfferingNote contextRef="offrl_2" id="ixv-254">(1) This Registration Statement (the "Registration Statement") registers the issuance of Class B Common Stock, par value $0.01 per share ("Class B Common Stock"), of Universal Health Services, Inc. (the "Company" or the "Registrant") issuable pursuant to the outstanding awards of unvested stock options and unvested restricted stock units assumed by the Company as a result of the consummation on August 17, 2026 of the transaction contemplated by that certain Agreement and Plan of Merger, dated as of March 9, 2026, by and among the Company, UHS Merger Subsidiary, Inc., a Delaware corporation and indirect wholly owned subsidiary of the Company, and Talkspace, Inc. Pursuant to Rule 416(a) of the Securities Act of 1933, as amended (the "Securities Act"), this Registration Statement on Form S-8 also covers any additional securities of the Company that may be offered or become issuable under the Talkspace, Inc. 2021 Incentive Award Plan, as amended (the "Talkspace Plan"), in connection with any stock split, stock dividend, recapitalization, or any other similar transaction effected without receipt of consideration, which results in an increase in the number of outstanding shares of Class B Common Stock. (3) Estimated solely for the purpose of calculating the registration fee pursuant to Rules 457(c) and 457(h) under the Securities Act, based on the average of the high and low prices of Class B Common Stock as reported on the New York Stock Exchange on August 12, 2026.</ffd:OfferingNote>
</xbrl>
