| | | | | | | | | | | | | | | | | | | | | |
<?xml version="1.0" encoding="windows-1252"?> |
<FilingSummary> |
| <Version> 3.24.1 </Version> |
| <ProcessingTime/> |
| <ReportFormat> html </ReportFormat> |
| <ContextCount> 296 </ContextCount> |
| <ElementCount> 388 </ElementCount> |
| <EntityCount> 1 </EntityCount> |
| <FootnotesReported> false </FootnotesReported> |
| <SegmentCount> 100 </SegmentCount> |
| <ScenarioCount> 0 </ScenarioCount> |
| <TuplesReported> false </TuplesReported> |
| <UnitCount> 6 </UnitCount> |
| <MyReports> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R1.htm </HtmlFileName> |
| | | <LongName> 0000001 - Document - Cover </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/Cover </Role> |
| | | <ShortName> Cover </ShortName> |
| | | <MenuCategory> Cover </MenuCategory> |
| | | <Position> 1 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R2.htm </HtmlFileName> |
| | | <LongName> 0000002 - Document - Audit Information </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/AuditInformation </Role> |
| | | <ShortName> Audit Information </ShortName> |
| | | <MenuCategory> Cover </MenuCategory> |
| | | <Position> 2 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R3.htm </HtmlFileName> |
| | | <LongName> 0000003 - Statement - Consolidated Balance Sheets </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/ConsolidatedBalanceSheets </Role> |
| | | <ShortName> Consolidated Balance Sheets </ShortName> |
| | | <MenuCategory> Statements </MenuCategory> |
| | | <Position> 3 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R4.htm </HtmlFileName> |
| | | <LongName> 0000004 - Statement - Consolidated Balance Sheets (Parenthetical) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/ConsolidatedBalanceSheetsParenthetical </Role> |
| | | <ShortName> Consolidated Balance Sheets (Parenthetical) </ShortName> |
| | | <MenuCategory> Statements </MenuCategory> |
| | | <Position> 4 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R5.htm </HtmlFileName> |
| | | <LongName> 0000005 - Statement - Consolidated Statements of Operations and Comprehensive Loss </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/ConsolidatedStatementsofOperationsandComprehensiveLoss </Role> |
| | | <ShortName> Consolidated Statements of Operations and Comprehensive Loss </ShortName> |
| | | <MenuCategory> Statements </MenuCategory> |
| | | <Position> 5 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R6.htm </HtmlFileName> |
| | | <LongName> 0000006 - Statement - Consolidated Statements of Convertible Preferred Stock, Redeemable Common Stock and Stockholders' Equity (Deficit) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/ConsolidatedStatementsofConvertiblePreferredStockRedeemableCommonStockandStockholdersEquityDeficit </Role> |
| | | <ShortName> Consolidated Statements of Convertible Preferred Stock, Redeemable Common Stock and Stockholders' Equity (Deficit) </ShortName> |
| | | <MenuCategory> Statements </MenuCategory> |
| | | <Position> 6 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R7.htm </HtmlFileName> |
| | | <LongName> 0000007 - Statement - Consolidated Statements of Cash Flows </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/ConsolidatedStatementsofCashFlows </Role> |
| | | <ShortName> Consolidated Statements of Cash Flows </ShortName> |
| | | <MenuCategory> Statements </MenuCategory> |
| | | <Position> 7 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R8.htm </HtmlFileName> |
| | | <LongName> 0000008 - Disclosure - Nature of the Business and Basis of Presentation </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/NatureoftheBusinessandBasisofPresentation </Role> |
| | | <ShortName> Nature of the Business and Basis of Presentation </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 8 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R9.htm </HtmlFileName> |
| | | <LongName> 0000009 - Disclosure - Summary of Significant Accounting Policies </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/SummaryofSignificantAccountingPolicies </Role> |
| | | <ShortName> Summary of Significant Accounting Policies </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 9 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R10.htm </HtmlFileName> |
| | | <LongName> 0000010 - Disclosure - License, Collaboration, and Funding Agreements </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LicenseCollaborationandFundingAgreements </Role> |
| | | <ShortName> License, Collaboration, and Funding Agreements </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 10 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R11.htm </HtmlFileName> |
| | | <LongName> 0000011 - Disclosure - Fair Value of Financial Assets and Liabilities </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilities </Role> |
| | | <ShortName> Fair Value of Financial Assets and Liabilities </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 11 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R12.htm </HtmlFileName> |
| | | <LongName> 0000012 - Disclosure - Property and Equipment, Net </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/PropertyandEquipmentNet </Role> |
| | | <ShortName> Property and Equipment, Net </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 12 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R13.htm </HtmlFileName> |
| | | <LongName> 0000013 - Disclosure - Accrued Expenses </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/AccruedExpenses </Role> |
| | | <ShortName> Accrued Expenses </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 13 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R14.htm </HtmlFileName> |
| | | <LongName> 0000014 - Disclosure - Long-Term Debt </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LongTermDebt </Role> |
| | | <ShortName> Long-Term Debt </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 14 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R15.htm </HtmlFileName> |
| | | <LongName> 0000015 - Disclosure - Leases </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/Leases </Role> |
| | | <ShortName> Leases </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 15 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R16.htm </HtmlFileName> |
| | | <LongName> 0000016 - Disclosure - Commitment and Contingencies </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/CommitmentandContingencies </Role> |
| | | <ShortName> Commitment and Contingencies </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 16 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R17.htm </HtmlFileName> |
| | | <LongName> 0000017 - Disclosure - Preferred and Common Stock Warrants </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/PreferredandCommonStockWarrants </Role> |
| | | <ShortName> Preferred and Common Stock Warrants </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 17 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R18.htm </HtmlFileName> |
| | | <LongName> 0000018 - Disclosure - Common Stock, Redeemable Common Stock and Convertible Preferred Stock (converted to Common Stock) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/CommonStockRedeemableCommonStockandConvertiblePreferredStockconvertedtoCommonStock </Role> |
| | | <ShortName> Common Stock, Redeemable Common Stock and Convertible Preferred Stock (converted to Common Stock) </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 18 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R19.htm </HtmlFileName> |
| | | <LongName> 0000019 - Disclosure - Stock-Based Compensation </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/StockBasedCompensation </Role> |
| | | <ShortName> Stock-Based Compensation </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 19 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R20.htm </HtmlFileName> |
| | | <LongName> 0000020 - Disclosure - Income Taxes </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/IncomeTaxes </Role> |
| | | <ShortName> Income Taxes </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 20 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R21.htm </HtmlFileName> |
| | | <LongName> 0000021 - Disclosure - Net Loss per Share </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/NetLossperShare </Role> |
| | | <ShortName> Net Loss per Share </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 21 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R22.htm </HtmlFileName> |
| | | <LongName> 0000022 - Disclosure - Loss on Transfer of Nonfinancial Assets </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LossonTransferofNonfinancialAssets </Role> |
| | | <ShortName> Loss on Transfer of Nonfinancial Assets </ShortName> |
| | | <MenuCategory> Notes </MenuCategory> |
| | | <Position> 22 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R23.htm </HtmlFileName> |
| | | <LongName> 9954471 - Disclosure - Summary of Significant Accounting Policies (Policies) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/SummaryofSignificantAccountingPoliciesPolicies </Role> |
| | | <ShortName> Summary of Significant Accounting Policies (Policies) </ShortName> |
| | | <MenuCategory> Policies </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/SummaryofSignificantAccountingPolicies </ParentRole> |
| | | <Position> 23 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R24.htm </HtmlFileName> |
| | | <LongName> 9954472 - Disclosure - Summary of Significant Accounting Policies (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/SummaryofSignificantAccountingPoliciesTables </Role> |
| | | <ShortName> Summary of Significant Accounting Policies (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/SummaryofSignificantAccountingPolicies </ParentRole> |
| | | <Position> 24 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R25.htm </HtmlFileName> |
| | | <LongName> 9954473 - Disclosure - Fair Value of Financial Assets and Liabilities (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilitiesTables </Role> |
| | | <ShortName> Fair Value of Financial Assets and Liabilities (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilities </ParentRole> |
| | | <Position> 25 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R26.htm </HtmlFileName> |
| | | <LongName> 9954474 - Disclosure - Property and Equipment, Net (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/PropertyandEquipmentNetTables </Role> |
| | | <ShortName> Property and Equipment, Net (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/PropertyandEquipmentNet </ParentRole> |
| | | <Position> 26 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R27.htm </HtmlFileName> |
| | | <LongName> 9954475 - Disclosure - Accrued Expenses (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/AccruedExpensesTables </Role> |
| | | <ShortName> Accrued Expenses (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/AccruedExpenses </ParentRole> |
| | | <Position> 27 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R28.htm </HtmlFileName> |
| | | <LongName> 9954476 - Disclosure - Long-Term Debt (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LongTermDebtTables </Role> |
| | | <ShortName> Long-Term Debt (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/LongTermDebt </ParentRole> |
| | | <Position> 28 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R29.htm </HtmlFileName> |
| | | <LongName> 9954477 - Disclosure - Leases (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LeasesTables </Role> |
| | | <ShortName> Leases (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/Leases </ParentRole> |
| | | <Position> 29 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R30.htm </HtmlFileName> |
| | | <LongName> 9954478 - Disclosure - Preferred and Common Stock Warrants (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/PreferredandCommonStockWarrantsTables </Role> |
| | | <ShortName> Preferred and Common Stock Warrants (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/PreferredandCommonStockWarrants </ParentRole> |
| | | <Position> 30 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R31.htm </HtmlFileName> |
| | | <LongName> 9954479 - Disclosure - Stock-Based Compensation (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/StockBasedCompensationTables </Role> |
| | | <ShortName> Stock-Based Compensation (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/StockBasedCompensation </ParentRole> |
| | | <Position> 31 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R32.htm </HtmlFileName> |
| | | <LongName> 9954480 - Disclosure - Income Taxes (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/IncomeTaxesTables </Role> |
| | | <ShortName> Income Taxes (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/IncomeTaxes </ParentRole> |
| | | <Position> 32 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R33.htm </HtmlFileName> |
| | | <LongName> 9954481 - Disclosure - Net Loss per Share (Tables) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/NetLossperShareTables </Role> |
| | | <ShortName> Net Loss per Share (Tables) </ShortName> |
| | | <MenuCategory> Tables </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/NetLossperShare </ParentRole> |
| | | <Position> 33 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R34.htm </HtmlFileName> |
| | | <LongName> 9954482 - Disclosure - Nature of the Business and Basis of Presentation (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/NatureoftheBusinessandBasisofPresentationDetails </Role> |
| | | <ShortName> Nature of the Business and Basis of Presentation (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/NatureoftheBusinessandBasisofPresentation </ParentRole> |
| | | <Position> 34 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R35.htm </HtmlFileName> |
| | | <LongName> 9954483 - Disclosure - Summary of Significant Accounting Policies - Schedule of Restricted Cash (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/SummaryofSignificantAccountingPoliciesScheduleofRestrictedCashDetails </Role> |
| | | <ShortName> Summary of Significant Accounting Policies - Schedule of Restricted Cash (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 35 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R36.htm </HtmlFileName> |
| | | <LongName> 9954484 - Disclosure - Summary of Significant Accounting Policies - Schedule of Cash, Cash Equivalents and Restricted Cash (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/SummaryofSignificantAccountingPoliciesScheduleofCashCashEquivalentsandRestrictedCashDetails </Role> |
| | | <ShortName> Summary of Significant Accounting Policies - Schedule of Cash, Cash Equivalents and Restricted Cash (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 36 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R37.htm </HtmlFileName> |
| | | <LongName> 9954485 - Disclosure - Summary of Significant Accounting Policies - Schedule of Property, Plant and Equipment (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/SummaryofSignificantAccountingPoliciesScheduleofPropertyPlantandEquipmentDetails </Role> |
| | | <ShortName> Summary of Significant Accounting Policies - Schedule of Property, Plant and Equipment (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 37 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R38.htm </HtmlFileName> |
| | | <LongName> 9954486 - Disclosure - Summary of Significant Policies - Additional Information (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/SummaryofSignificantPoliciesAdditionalInformationDetails </Role> |
| | | <ShortName> Summary of Significant Policies - Additional Information (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 38 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R39.htm </HtmlFileName> |
| | | <LongName> 9954487 - Disclosure - License, Collaboration, and Funding Agreements - Genzyme Agreement (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LicenseCollaborationandFundingAgreementsGenzymeAgreementDetails </Role> |
| | | <ShortName> License, Collaboration, and Funding Agreements - Genzyme Agreement (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 39 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R40.htm </HtmlFileName> |
| | | <LongName> 9954488 - Disclosure - License, Collaboration, and Funding Agreements - Georgetown Agreement (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LicenseCollaborationandFundingAgreementsGeorgetownAgreementDetails </Role> |
| | | <ShortName> License, Collaboration, and Funding Agreements - Georgetown Agreement (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 40 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R41.htm </HtmlFileName> |
| | | <LongName> 9954489 - Disclosure - License, Collaboration, and Funding Agreements - Beth Israel Deaconess Medical Center Agreements (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LicenseCollaborationandFundingAgreementsBethIsraelDeaconessMedicalCenterAgreementsDetails </Role> |
| | | <ShortName> License, Collaboration, and Funding Agreements - Beth Israel Deaconess Medical Center Agreements (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 41 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R42.htm </HtmlFileName> |
| | | <LongName> 9954490 - Disclosure - License, Collaboration, and Funding Agreements - Research and Development Incentive Program (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LicenseCollaborationandFundingAgreementsResearchandDevelopmentIncentiveProgramDetails </Role> |
| | | <ShortName> License, Collaboration, and Funding Agreements - Research and Development Incentive Program (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 42 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R43.htm </HtmlFileName> |
| | | <LongName> 9954491 - Disclosure - License, Collaboration, and Funding Agreements (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LicenseCollaborationandFundingAgreementsDetails </Role> |
| | | <ShortName> License, Collaboration, and Funding Agreements (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/LicenseCollaborationandFundingAgreements </ParentRole> |
| | | <Position> 43 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R44.htm </HtmlFileName> |
| | | <LongName> 9954492 - Disclosure - Fair Value of Financial Assets and Liabilities - Measured on a Recurring Basis (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilitiesMeasuredonaRecurringBasisDetails </Role> |
| | | <ShortName> Fair Value of Financial Assets and Liabilities - Measured on a Recurring Basis (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 44 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R45.htm </HtmlFileName> |
| | | <LongName> 9954493 - Disclosure - Fair Value of Financial Assets and Liabilities - Debt Securities Available-for-Sale (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilitiesDebtSecuritiesAvailableforSaleDetails </Role> |
| | | <ShortName> Fair Value of Financial Assets and Liabilities - Debt Securities Available-for-Sale (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 45 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R46.htm </HtmlFileName> |
| | | <LongName> 9954494 - Disclosure - Fair Value of Financial Assets and Liabilities - Narrative (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilitiesNarrativeDetails </Role> |
| | | <ShortName> Fair Value of Financial Assets and Liabilities - Narrative (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 46 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R47.htm </HtmlFileName> |
| | | <LongName> 9954495 - Disclosure - Fair Value of Financial Assets and Liabilities -Aggregate Fair Value of Warrant and Derivative Liabilities (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilitiesAggregateFairValueofWarrantandDerivativeLiabilitiesDetails </Role> |
| | | <ShortName> Fair Value of Financial Assets and Liabilities -Aggregate Fair Value of Warrant and Derivative Liabilities (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 47 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R48.htm </HtmlFileName> |
| | | <LongName> 9954496 - Disclosure - Fair Value of Financial Assets and Liabilities - Assumptions (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilitiesAssumptionsDetails </Role> |
| | | <ShortName> Fair Value of Financial Assets and Liabilities - Assumptions (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 48 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R49.htm </HtmlFileName> |
| | | <LongName> 9954497 - Disclosure - Fair Value of Financial Assets and Liabilities - Goodwill Rollforward (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/FairValueofFinancialAssetsandLiabilitiesGoodwillRollforwardDetails </Role> |
| | | <ShortName> Fair Value of Financial Assets and Liabilities - Goodwill Rollforward (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 49 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R50.htm </HtmlFileName> |
| | | <LongName> 9954498 - Disclosure - Property and Equipment, Net (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/PropertyandEquipmentNetDetails </Role> |
| | | <ShortName> Property and Equipment, Net (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/PropertyandEquipmentNetTables </ParentRole> |
| | | <Position> 50 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R51.htm </HtmlFileName> |
| | | <LongName> 9954499 - Disclosure - Accrued Expenses (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/AccruedExpensesDetails </Role> |
| | | <ShortName> Accrued Expenses (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/AccruedExpensesTables </ParentRole> |
| | | <Position> 51 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R52.htm </HtmlFileName> |
| | | <LongName> 9954500 - Disclosure - Long-Term Debt - Schedule of Long-Term Debt (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LongTermDebtScheduleofLongTermDebtDetails </Role> |
| | | <ShortName> Long-Term Debt - Schedule of Long-Term Debt (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 52 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R53.htm </HtmlFileName> |
| | | <LongName> 9954501 - Disclosure - Long-Term Debt - Narrative (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LongTermDebtNarrativeDetails </Role> |
| | | <ShortName> Long-Term Debt - Narrative (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 53 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R54.htm </HtmlFileName> |
| | | <LongName> 9954502 - Disclosure - Long-Term Debt - Hercules Loan Agreements (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LongTermDebtHerculesLoanAgreementsDetails </Role> |
| | | <ShortName> Long-Term Debt - Hercules Loan Agreements (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 54 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R55.htm </HtmlFileName> |
| | | <LongName> 9954503 - Disclosure - Long-Term Debt - Future Principal Payments (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LongTermDebtFuturePrincipalPaymentsDetails </Role> |
| | | <ShortName> Long-Term Debt - Future Principal Payments (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 55 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R56.htm </HtmlFileName> |
| | | <LongName> 9954504 - Disclosure - Leases (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LeasesDetails </Role> |
| | | <ShortName> Leases (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/LeasesTables </ParentRole> |
| | | <Position> 56 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R57.htm </HtmlFileName> |
| | | <LongName> 9954505 - Disclosure - Leases - Schedule of Components of Lease Expense (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LeasesScheduleofComponentsofLeaseExpenseDetails </Role> |
| | | <ShortName> Leases - Schedule of Components of Lease Expense (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 57 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R58.htm </HtmlFileName> |
| | | <LongName> 9954506 - Disclosure - Leases - Schedule of Maturities of Lease Liabilities (Detail) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/LeasesScheduleofMaturitiesofLeaseLiabilitiesDetail </Role> |
| | | <ShortName> Leases - Schedule of Maturities of Lease Liabilities (Detail) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 58 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R59.htm </HtmlFileName> |
| | | <LongName> 9954507 - Disclosure - Preferred and Common Stock Warrants - Additional Information (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/PreferredandCommonStockWarrantsAdditionalInformationDetails </Role> |
| | | <ShortName> Preferred and Common Stock Warrants - Additional Information (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 59 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R60.htm </HtmlFileName> |
| | | <LongName> 9954508 - Disclosure - Preferred and Common Stock Warrants - Schedule of Outstanding Warrants (Detail) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/PreferredandCommonStockWarrantsScheduleofOutstandingWarrantsDetail </Role> |
| | | <ShortName> Preferred and Common Stock Warrants - Schedule of Outstanding Warrants (Detail) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 60 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R61.htm </HtmlFileName> |
| | | <LongName> 9954509 - Disclosure - Preferred and Common Stock Warrants - Summary of Outstanding Warrants to Purchase Shares of Common Stock (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/PreferredandCommonStockWarrantsSummaryofOutstandingWarrantstoPurchaseSharesofCommonStockDetails </Role> |
| | | <ShortName> Preferred and Common Stock Warrants - Summary of Outstanding Warrants to Purchase Shares of Common Stock (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 61 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R62.htm </HtmlFileName> |
| | | <LongName> 9954510 - Disclosure - Common Stock, Redeemable Common Stock and Convertible Preferred Stock (converted to Common Stock) - Additional Information (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/CommonStockRedeemableCommonStockandConvertiblePreferredStockconvertedtoCommonStockAdditionalInformationDetails </Role> |
| | | <ShortName> Common Stock, Redeemable Common Stock and Convertible Preferred Stock (converted to Common Stock) - Additional Information (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/CommonStockRedeemableCommonStockandConvertiblePreferredStockconvertedtoCommonStock </ParentRole> |
| | | <Position> 62 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R63.htm </HtmlFileName> |
| | | <LongName> 9954511 - Disclosure - Stock-Based Compensation - Additional Information (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/StockBasedCompensationAdditionalInformationDetails </Role> |
| | | <ShortName> Stock-Based Compensation - Additional Information (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 63 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R64.htm </HtmlFileName> |
| | | <LongName> 9954512 - Disclosure - Stock-Based Compensation - Summary of Stock Option Activity (Detail) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/StockBasedCompensationSummaryofStockOptionActivityDetail </Role> |
| | | <ShortName> Stock-Based Compensation - Summary of Stock Option Activity (Detail) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 64 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R65.htm </HtmlFileName> |
| | | <LongName> 9954513 - Disclosure - Stock-Based Compensation - Restricted Stock Units (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/StockBasedCompensationRestrictedStockUnitsDetails </Role> |
| | | <ShortName> Stock-Based Compensation - Restricted Stock Units (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 65 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R66.htm </HtmlFileName> |
| | | <LongName> 9954514 - Disclosure - Stock-Based Compensation - Summary of Stock-Based Compensation Expense Classification (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/StockBasedCompensationSummaryofStockBasedCompensationExpenseClassificationDetails </Role> |
| | | <ShortName> Stock-Based Compensation - Summary of Stock-Based Compensation Expense Classification (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 66 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R67.htm </HtmlFileName> |
| | | <LongName> 9954515 - Disclosure - Stock-Based Compensation - Stock Option Valuation (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/StockBasedCompensationStockOptionValuationDetails </Role> |
| | | <ShortName> Stock-Based Compensation - Stock Option Valuation (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 67 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R68.htm </HtmlFileName> |
| | | <LongName> 9954516 - Disclosure - Income Taxes - Schedule of Income Loss Before Income Taxes (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/IncomeTaxesScheduleofIncomeLossBeforeIncomeTaxesDetails </Role> |
| | | <ShortName> Income Taxes - Schedule of Income Loss Before Income Taxes (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 68 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R69.htm </HtmlFileName> |
| | | <LongName> 9954517 - Disclosure - Income Taxes - Reconciliation of Effective Income Tax Rate (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/IncomeTaxesReconciliationofEffectiveIncomeTaxRateDetails </Role> |
| | | <ShortName> Income Taxes - Reconciliation of Effective Income Tax Rate (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 69 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R70.htm </HtmlFileName> |
| | | <LongName> 9954518 - Disclosure - Income Taxes - Deferred Income Tax Asset (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/IncomeTaxesDeferredIncomeTaxAssetDetails </Role> |
| | | <ShortName> Income Taxes - Deferred Income Tax Asset (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 70 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R71.htm </HtmlFileName> |
| | | <LongName> 9954519 - Disclosure - Income Taxes - Narrative (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/IncomeTaxesNarrativeDetails </Role> |
| | | <ShortName> Income Taxes - Narrative (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 71 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R72.htm </HtmlFileName> |
| | | <LongName> 9954520 - Disclosure - Income Taxes - Deferred Tax Valuation Allowance (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/IncomeTaxesDeferredTaxValuationAllowanceDetails </Role> |
| | | <ShortName> Income Taxes - Deferred Tax Valuation Allowance (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 72 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R73.htm </HtmlFileName> |
| | | <LongName> 9954521 - Disclosure - Income Taxes (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/IncomeTaxesDetails </Role> |
| | | <ShortName> Income Taxes (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <ParentRole> http://www.x4pharma.com/role/IncomeTaxesTables </ParentRole> |
| | | <Position> 73 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R74.htm </HtmlFileName> |
| | | <LongName> 9954522 - Disclosure - Net Loss per Share - Summary of Basic and Diluted Net loss per Share Attributable to Common Stockholders (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/NetLossperShareSummaryofBasicandDilutedNetlossperShareAttributabletoCommonStockholdersDetails </Role> |
| | | <ShortName> Net Loss per Share - Summary of Basic and Diluted Net loss per Share Attributable to Common Stockholders (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 74 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R75.htm </HtmlFileName> |
| | | <LongName> 9954523 - Disclosure - Net Loss per Share - Additional Information (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/NetLossperShareAdditionalInformationDetails </Role> |
| | | <ShortName> Net Loss per Share - Additional Information (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 75 </Position> |
| | | </Report> |
| | <Report instance="xfor-20231231.htm"> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <HtmlFileName> R76.htm </HtmlFileName> |
| | | <LongName> 9954524 - Disclosure - Net Loss per Share - Schedule of Anti-dilutive Securities Excluded from Computation of Diluted Net Loss per Share Attributable to Common Stockholders (Details) </LongName> |
| | | <ReportType> Sheet </ReportType> |
| | | <Role> http://www.x4pharma.com/role/NetLossperShareScheduleofAntidilutiveSecuritiesExcludedfromComputationofDilutedNetLossperShareAttributabletoCommonStockholdersDetails </Role> |
| | | <ShortName> Net Loss per Share - Schedule of Anti-dilutive Securities Excluded from Computation of Diluted Net Loss per Share Attributable to Common Stockholders (Details) </ShortName> |
| | | <MenuCategory> Details </MenuCategory> |
| | | <Position> 76 </Position> |
| | | </Report> |
| | <Report> |
| | | <IsDefault> false </IsDefault> |
| | | <HasEmbeddedReports> false </HasEmbeddedReports> |
| | | <LongName> All Reports </LongName> |
| | | <ReportType> Book </ReportType> |
| | | <ShortName> All Reports </ShortName> |
| | | </Report> |
| | </MyReports> |
| <Logs> |
| | <Log type="Warning"> [ix-0514-Hidden-Fact-Eligible-For-Transform] WARN: 12 fact(s) appearing in ix:hidden were eligible for transformation: dei:DocumentType, dei:EntityAddressAddressLine1, dei:EntityAddressAddressLine2, dei:EntityAddressCityOrTown, dei:EntityAddressPostalZipCode, dei:EntityAddressStateOrProvince, dei:EntityIncorporationStateCountryCode, us-gaap:IntangibleAssetsDisclosureTextBlock, us-gaap:NumberOfReportingUnits, us-gaap:ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1, xfor:CollaborativeArrangementTransactionStatementOfIncomeOrComprehensiveIncomeExtensibleEnumerationNotDisclosedFlag, xfor:OperatingLeaseRightOfUseAssetAmortizationTerm - xfor-20231231.htm 4 </Log> |
| | </Logs> |
| <InputFiles> |
| | <File doctype="10-K" isDefinitelyFs="true" isUsgaap="true" original="xfor-20231231.htm"> xfor-20231231.htm </File> |
| | <File> xfor-20231231.xsd </File> |
| | <File> xfor-20231231_cal.xml </File> |
| | <File> xfor-20231231_def.xml </File> |
| | <File> xfor-20231231_lab.xml </File> |
| | <File> xfor-20231231_pre.xml </File> |
| | </InputFiles> |
| <SupplementalFiles> |
| | <File> xfor-20231231_g1.jpg </File> |
| | </SupplementalFiles> |
| <BaseTaxonomies> |
| | <BaseTaxonomy items="860"> http://fasb.org/us-gaap/2023 </BaseTaxonomy> |
| | <BaseTaxonomy items="46"> http://xbrl.sec.gov/dei/2023 </BaseTaxonomy> |
| | </BaseTaxonomies> |
| <HasPresentationLinkbase> true </HasPresentationLinkbase> |
| <HasCalculationLinkbase> true </HasCalculationLinkbase> |
| </FilingSummary> |