The severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) infection causes COVID-19, a pandemic that seriously threatens global health. SARS CoV-2 propagates by packaging its RNA genome into membrane enclosures in host cells. The packaging of the viral genome into the nascent virion is mediated by the nucleocapsid (N) protein, but the underlying mechanism remains unclear. Here, we show that the N protein forms biomolecular condensates with viral RNA both in vitro and in mammalian cells. While the N protein forms spherical assemblies with unstructured RNA, it forms mesh like-structures with viral RNA strands that contain secondary structure elements. Cross-linking mass spectrometry identified an intrinsically-disordered region that forms interactions between N proteins in condensates, and truncation of this region disrupts phase separation. By screening 1,200 FDA approved drugs in vitro, we identified a kinase inhibitor nilotinib, which affects the morphology of N condensates in vitro and disrupts phase separation of the N protein in vivo. These results indicate that the N protein compartmentalizes viral RNA in infected cells through liquid-liquid phase separation, and this process can be disrupted by a possible drug candidate.