<?xml version="1.0" encoding="utf-8"?>
<xbrl
  xml:lang="en-US"
  xmlns="http://www.xbrl.org/2003/instance"
  xmlns:dei="http://xbrl.sec.gov/dei/2025"
  xmlns:ffd="http://xbrl.sec.gov/ffd/2025"
  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/2025/ffd-2025.xsd"
      xlink:type="simple"/>
    <context id="c-1">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001501697</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>1</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-05-06</startDate>
            <endDate>2026-05-06</endDate>
        </period>
    </context>
    <context id="c-2">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001501697</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>2</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-05-06</startDate>
            <endDate>2026-05-06</endDate>
        </period>
    </context>
    <context id="c-3">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001501697</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>3</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-05-06</startDate>
            <endDate>2026-05-06</endDate>
        </period>
    </context>
    <context id="c-4">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001501697</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>4</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-05-06</startDate>
            <endDate>2026-05-06</endDate>
        </period>
    </context>
    <context id="c-5">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001501697</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>5</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-05-06</startDate>
            <endDate>2026-05-06</endDate>
        </period>
    </context>
    <context id="c-6">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001501697</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>6</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-05-06</startDate>
            <endDate>2026-05-06</endDate>
        </period>
    </context>
    <context id="c-7">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001501697</identifier>
            <segment>
                <xbrldi:typedMember dimension="ffd:OfferingAxis">
                    <dei:lineNo>7</dei:lineNo>
                </xbrldi:typedMember>
            </segment>
        </entity>
        <period>
            <startDate>2026-05-06</startDate>
            <endDate>2026-05-06</endDate>
        </period>
    </context>
    <context id="c-8">
        <entity>
            <identifier scheme="http://www.sec.gov/CIK">0001501697</identifier>
        </entity>
        <period>
            <startDate>2026-05-06</startDate>
            <endDate>2026-05-06</endDate>
        </period>
    </context>
    <unit id="usd">
        <measure>iso4217:USD</measure>
    </unit>
    <unit id="number">
        <measure>pure</measure>
    </unit>
    <dei:EntityCentralIndexKey contextRef="c-8" id="f-57">0001501697</dei:EntityCentralIndexKey>
    <dei:EntityRegistrantName contextRef="c-8" id="f-58">X4 Pharmaceuticals, Inc.</dei:EntityRegistrantName>
    <ffd:FormTp contextRef="c-8" id="f-59">S-3</ffd:FormTp>
    <ffd:SubmissnTp contextRef="c-8" id="f-60">S-3</ffd:SubmissnTp>
    <ffd:FeeExhibitTp contextRef="c-8" id="f-61">EX-FILING FEES</ffd:FeeExhibitTp>
    <ffd:OffsetTableNa contextRef="c-8" id="f-62">N/A</ffd:OffsetTableNa>
    <ffd:CombinedProspectusTableNa contextRef="c-8" id="f-63">N/A</ffd:CombinedProspectusTableNa>
    <ffd:OfferingSctyTp contextRef="c-1" id="f-1">Unallocated (Universal) Shelf</ffd:OfferingSctyTp>
    <ffd:PrevslyPdFlg contextRef="c-1" id="f-2">false</ffd:PrevslyPdFlg>
    <ffd:Rule457oFlg contextRef="c-1" id="f-3">true</ffd:Rule457oFlg>
    <ffd:MaxAggtOfferingPric contextRef="c-1" decimals="0" id="f-4" unitRef="usd">187710270</ffd:MaxAggtOfferingPric>
    <ffd:FeeRate contextRef="c-1" decimals="7" id="f-5" unitRef="number">0.0001381</ffd:FeeRate>
    <ffd:FeeAmt contextRef="c-1" decimals="2" id="f-6" unitRef="usd">25922.79</ffd:FeeAmt>
    <ffd:OfferingSctyTp contextRef="c-2" id="f-7">Equity</ffd:OfferingSctyTp>
    <ffd:OfferingSctyTitl contextRef="c-2" id="f-8">Common Stock, $0.001 par value per share (1)</ffd:OfferingSctyTitl>
    <ffd:Rule415a6Flg contextRef="c-2" id="f-9">true</ffd:Rule415a6Flg>
    <ffd:MaxAggtOfferingPric contextRef="c-2" decimals="0" id="f-10" unitRef="usd">48603790</ffd:MaxAggtOfferingPric>
    <ffd:CfwdFormTp contextRef="c-2" id="f-11">S-3</ffd:CfwdFormTp>
    <ffd:CfwdPrrFileNb contextRef="c-2" id="f-12">333-273961</ffd:CfwdPrrFileNb>
    <ffd:CfwdPrrFctvDt contextRef="c-2" id="f-13">2023-08-24</ffd:CfwdPrrFctvDt>
    <ffd:CfwdPrevslyPdFee contextRef="c-2" decimals="2" id="f-14" unitRef="usd">5356.14</ffd:CfwdPrevslyPdFee>
    <ffd:OfferingSctyTp contextRef="c-3" id="f-15">Equity</ffd:OfferingSctyTp>
    <ffd:OfferingSctyTitl contextRef="c-3" id="f-16">Common Stock, $0.001 par value per share (1)</ffd:OfferingSctyTitl>
    <ffd:Rule415a6Flg contextRef="c-3" id="f-17">true</ffd:Rule415a6Flg>
    <ffd:MaxAggtOfferingPric contextRef="c-3" decimals="0" id="f-18" unitRef="usd">34794620</ffd:MaxAggtOfferingPric>
    <ffd:CfwdFormTp contextRef="c-3" id="f-19">S-3</ffd:CfwdFormTp>
    <ffd:CfwdPrrFileNb contextRef="c-3" id="f-20">333-273961</ffd:CfwdPrrFileNb>
    <ffd:CfwdPrrFctvDt contextRef="c-3" id="f-21">2023-08-24</ffd:CfwdPrrFctvDt>
    <ffd:CfwdPrevslyPdFee contextRef="c-3" decimals="2" id="f-22" unitRef="usd">3834.37</ffd:CfwdPrevslyPdFee>
    <ffd:OfferingSctyTp contextRef="c-4" id="f-23">Equity</ffd:OfferingSctyTp>
    <ffd:OfferingSctyTitl contextRef="c-4" id="f-24">Preferred Stock, $0.001 par value per share (1)</ffd:OfferingSctyTitl>
    <ffd:Rule415a6Flg contextRef="c-4" id="f-25">true</ffd:Rule415a6Flg>
    <ffd:CfwdFormTp contextRef="c-4" id="f-26">S-3</ffd:CfwdFormTp>
    <ffd:CfwdPrrFileNb contextRef="c-4" id="f-27">333-273961</ffd:CfwdPrrFileNb>
    <ffd:CfwdPrrFctvDt contextRef="c-4" id="f-28">2023-08-24</ffd:CfwdPrrFctvDt>
    <ffd:OfferingSctyTp contextRef="c-5" id="f-29">Debt</ffd:OfferingSctyTp>
    <ffd:OfferingSctyTitl contextRef="c-5" id="f-30">Debt Securities (1)</ffd:OfferingSctyTitl>
    <ffd:Rule415a6Flg contextRef="c-5" id="f-31">true</ffd:Rule415a6Flg>
    <ffd:CfwdFormTp contextRef="c-5" id="f-32">S-3</ffd:CfwdFormTp>
    <ffd:CfwdPrrFileNb contextRef="c-5" id="f-33">333-273961</ffd:CfwdPrrFileNb>
    <ffd:CfwdPrrFctvDt contextRef="c-5" id="f-34">2023-08-24</ffd:CfwdPrrFctvDt>
    <ffd:OfferingSctyTp contextRef="c-6" id="f-35">Other</ffd:OfferingSctyTp>
    <ffd:OfferingSctyTitl contextRef="c-6" id="f-36">Warrants (1)</ffd:OfferingSctyTitl>
    <ffd:Rule415a6Flg contextRef="c-6" id="f-37">true</ffd:Rule415a6Flg>
    <ffd:CfwdFormTp contextRef="c-6" id="f-38">S-3</ffd:CfwdFormTp>
    <ffd:CfwdPrrFileNb contextRef="c-6" id="f-39">333-273961</ffd:CfwdPrrFileNb>
    <ffd:CfwdPrrFctvDt contextRef="c-6" id="f-40">2023-08-24</ffd:CfwdPrrFctvDt>
    <ffd:OfferingSctyTp contextRef="c-7" id="f-41">Unallocated (Universal) Shelf</ffd:OfferingSctyTp>
    <ffd:Rule415a6Flg contextRef="c-7" id="f-42">true</ffd:Rule415a6Flg>
    <ffd:MaxAggtOfferingPric contextRef="c-7" decimals="0" id="f-43" unitRef="usd">28891320</ffd:MaxAggtOfferingPric>
    <ffd:CfwdFormTp contextRef="c-7" id="f-44">S-3</ffd:CfwdFormTp>
    <ffd:CfwdPrrFileNb contextRef="c-7" id="f-45">333-273961</ffd:CfwdPrrFileNb>
    <ffd:CfwdPrrFctvDt contextRef="c-7" id="f-46">2023-08-24</ffd:CfwdPrrFctvDt>
    <ffd:CfwdPrevslyPdFee contextRef="c-7" decimals="2" id="f-47" unitRef="usd">3183.82</ffd:CfwdPrevslyPdFee>
    <ffd:TtlOfferingAmt contextRef="c-8" decimals="0" id="f-48" unitRef="usd">300000000</ffd:TtlOfferingAmt>
    <ffd:TtlFeeAmt contextRef="c-8" decimals="2" id="f-49" unitRef="usd">25922.79</ffd:TtlFeeAmt>
    <ffd:TtlPrevslyPdAmt contextRef="c-8" id="f-50" unitRef="usd" xsi:nil="true"/>
    <ffd:TtlOffsetAmt contextRef="c-8" id="f-51" unitRef="usd" xsi:nil="true"/>
    <ffd:NetFeeAmt contextRef="c-8" decimals="2" id="f-52" unitRef="usd">25922.79</ffd:NetFeeAmt>
    <ffd:OfferingNote contextRef="c-3" id="f-54">Separate consideration may or may not be received for securities that are issuable upon the conversion or exercise of, or in exchange for, other securities offered hereby.&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:7.5pt;font-weight:400;line-height:112%"&gt;Pu&lt;/span&gt;&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:8pt;font-weight:400;line-height:112%"&gt;rsuant to Rule 415(a)(6) under the Securities Act, the securities registered pursuant to this registration statement include $112,289,730 of unsold securities (the &#x201c;August 2023 Unsold Securities&#x201d;) previously registered pursuant to the Registration Statement on Form S-3 (File No. 333-273961), which was declared effective on August 24, 2023 (the &#x201c;August 2023 Registration Statement&#x201d;). The August 2023 Unsold Securities include (x) $48,603,790 of unsold common stock pursuant to the sales agreement prospectus included in the August 2023 Registration Statement, (y) $34,794,620 of unsold common stock pursuant to the prospectus supplement dated January 14, 2022 and (z) $28,891,320 of unsold unallocated securities. In connection with the filing of the August 2023 Registration Statement, the Registrant paid a filing fee of $12,374.33 associated with the offering of the August 2023 Unsold Securities (based on the filing fee rate in effect at the time of the filing of the August 2023 Registration Statement). The filing fee associated with the offering of the August 2023 Unsold Securities is hereby carried forward to be applied to the August 2023 Unsold Securities registered hereunder, and no additional filing fee is due with respect to the August 2023 Unsold Securities in connection with the filing of this registration statement. To the extent that, after the filing date hereof and prior to the effectiveness of this registration statement, the Registrant sells any August 2023 Unsold Securities pursuant to the August 2023 Registration Statement, the Registrant will identify in a pre-effective amendment to this registration statement the updated number of August 2023 Unsold Securities from the August 2023 Registration Statement to be included in this registration statement pursuant to Rule 415(a)(6) and the updated amount of new securities to be registered on this registration statement. Pursuant to Rule 415(a)(6), the offering of securities under the August 2023 Registration Statement will be deemed terminated as of the date of effectiveness of this registration statement.&lt;/span&gt;</ffd:OfferingNote>
    <ffd:OfferingNote contextRef="c-2" id="f-53">Separate consideration may or may not be received for securities that are issuable upon the conversion or exercise of, or in exchange for, other securities offered hereby.&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:7.5pt;font-weight:400;line-height:112%"&gt;Pu&lt;/span&gt;&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:8pt;font-weight:400;line-height:112%"&gt;rsuant to Rule 415(a)(6) under the Securities Act, the securities registered pursuant to this registration statement include $112,289,730 of unsold securities (the &#x201c;August 2023 Unsold Securities&#x201d;) previously registered pursuant to the Registration Statement on Form S-3 (File No. 333-273961), which was declared effective on August 24, 2023 (the &#x201c;August 2023 Registration Statement&#x201d;). The August 2023 Unsold Securities include (x) $48,603,790 of unsold common stock pursuant to the sales agreement prospectus included in the August 2023 Registration Statement, (y) $34,794,620 of unsold common stock pursuant to the prospectus supplement dated January 14, 2022 and (z) $28,891,320 of unsold unallocated securities. In connection with the filing of the August 2023 Registration Statement, the Registrant paid a filing fee of $12,374.33 associated with the offering of the August 2023 Unsold Securities (based on the filing fee rate in effect at the time of the filing of the August 2023 Registration Statement). The filing fee associated with the offering of the August 2023 Unsold Securities is hereby carried forward to be applied to the August 2023 Unsold Securities registered hereunder, and no additional filing fee is due with respect to the August 2023 Unsold Securities in connection with the filing of this registration statement. To the extent that, after the filing date hereof and prior to the effectiveness of this registration statement, the Registrant sells any August 2023 Unsold Securities pursuant to the August 2023 Registration Statement, the Registrant will identify in a pre-effective amendment to this registration statement the updated number of August 2023 Unsold Securities from the August 2023 Registration Statement to be included in this registration statement pursuant to Rule 415(a)(6) and the updated amount of new securities to be registered on this registration statement. Pursuant to Rule 415(a)(6), the offering of securities under the August 2023 Registration Statement will be deemed terminated as of the date of effectiveness of this registration statement.&lt;/span&gt;</ffd:OfferingNote>
    <ffd:OfferingNote contextRef="c-1" id="f-55">X4 Pharmaceuticals, Inc. (the &#x201c;Registrant&#x201d;) is registering hereunder such indeterminate number of shares of common stock and preferred stock, such indeterminate principal amount of debt securities and such indeterminate number of warrants to purchase common stock, preferred stock and/or debt securities to be sold by the Registrant from time to time at unspecified prices which shall have an aggregate initial offering price not to exceed $300,000,000. If any debt securities are issued at an original issue discount, then the principal amount of such debt securities shall be in such greater amount as shall result in an aggregate initial offering price not to exceed $300,000,000, less the aggregate dollar amount of all securities previously issued hereunder. The securities registered for sale also include such indeterminate number of shares of common stock and preferred stock as may be issued upon conversion of debt securities, such indeterminate number of shares of common stock that may be issued upon conversion of preferred stock and such indeterminate number of shares of common stock and preferred stock and principal amount of debt securities that may be issued upon exercise of warrants. In addition, pursuant to Rule 416 under the Securities Act of 1933, as amended (the &#x201c;Securities Act&#x201d;), the shares being registered hereunder include such indeterminate number of shares of common stock and preferred stock as may be issuable with respect to the shares being registered hereunder as a result of stock splits, stock dividends or similar transactions.&lt;div style="padding-left:13.5pt;text-indent:-13.5pt"&gt;&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:9pt;font-weight:400;line-height:112%"&gt;(3) &lt;/span&gt;&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:7.5pt;font-weight:400;line-height:112%"&gt;T&lt;/span&gt;&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:8pt;font-weight:400;line-height:112%"&gt;he proposed maximum offering price per share will be determined, from time to time, by the Registrant in connection with the issuance by the Registrant of the securities registered hereunder and is not specified as to each class of security pursuant to Instruction 2.A.iii.b. to the Calculation of Filing Fee Tables and Related Disclosure on Item 16(b) of Form S-3 under the Securities Act&lt;/span&gt;&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:7.5pt;font-weight:400;line-height:112%"&gt;.&lt;/span&gt;&lt;/div&gt;</ffd:OfferingNote>
    <ffd:OfferingNote contextRef="c-4" id="f-56">&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:7.5pt;font-weight:400;line-height:112%"&gt;Pu&lt;/span&gt;&lt;span style="color:#000000;font-family:'Times New Roman',serif;font-size:8pt;font-weight:400;line-height:112%"&gt;rsuant to Rule 415(a)(6) under the Securities Act, the securities registered pursuant to this registration statement include $112,289,730 of unsold securities (the &#x201c;August 2023 Unsold Securities&#x201d;) previously registered pursuant to the Registration Statement on Form S-3 (File No. 333-273961), which was declared effective on August 24, 2023 (the &#x201c;August 2023 Registration Statement&#x201d;). The August 2023 Unsold Securities include (x) $48,603,790 of unsold common stock pursuant to the sales agreement prospectus included in the August 2023 Registration Statement, (y) $34,794,620 of unsold common stock pursuant to the prospectus supplement dated January 14, 2022 and (z) $28,891,320 of unsold unallocated securities. In connection with the filing of the August 2023 Registration Statement, the Registrant paid a filing fee of $12,374.33 associated with the offering of the August 2023 Unsold Securities (based on the filing fee rate in effect at the time of the filing of the August 2023 Registration Statement). The filing fee associated with the offering of the August 2023 Unsold Securities is hereby carried forward to be applied to the August 2023 Unsold Securities registered hereunder, and no additional filing fee is due with respect to the August 2023 Unsold Securities in connection with the filing of this registration statement. To the extent that, after the filing date hereof and prior to the effectiveness of this registration statement, the Registrant sells any August 2023 Unsold Securities pursuant to the August 2023 Registration Statement, the Registrant will identify in a pre-effective amendment to this registration statement the updated number of August 2023 Unsold Securities from the August 2023 Registration Statement to be included in this registration statement pursuant to Rule 415(a)(6) and the updated amount of new securities to be registered on this registration statement. Pursuant to Rule 415(a)(6), the offering of securities under the August 2023 Registration Statement will be deemed terminated as of the date of effectiveness of this registration statement.&lt;/span&gt;</ffd:OfferingNote>
</xbrl>
