Hedgehog (Hh) pathway has a pivotal function in development and tumorigenesis, processes sustained by stem cells (SCs). The transcription factor Nanog controls stemness acting as a key determinant of both embryonic SC self-renewal and differentiated somatic cells reprogramming to pluripotency, in concert with the loss of the oncosuppressor p53. How Nanog is regulated by microenvironmental signals in postnatal SC niches has been poorly investigated. Here, we show that Nanog is highly expressed in SCs from postnatal cerebellum and medulloblastoma, and acts as a critical mediator of Hh-driven self-renewal. Indeed, the downstream effectors of Hh activity, Gli1 and Gli2, bind to Nanog-specific cis-regulatory sequences both in mouse and human SCs. Loss of p53, a key event promoting cell stemness, activates Hh signalling, thereby contributing to Nanog upregulation. Conversely, Hh downregulates p53 but does not require p53 to control Nanog. Our data reveal a mechanism for the function of Hh in the control of stemness that represents a crucial component of an integrated circuitry determining cell fate decision and involved in the maintenance of cancer SCs.