Newar caste system is the system by which Newārs, the historical inhabitants of Kathmandu Valley, are divided into groups on the basis of Vedic varna model and divided according to their hereditary occupations. First introduced at the time of the Licchavis (A.D. 300 – c. 879), the Newar caste system assumed its present shape during the medieval Malla period (A.D. 1201–1769). The Newar caste structure resembles more closely that of North India and Madheshis than that of Khas 'Parbatiyas' in that all four Varna (Brahmin, Kshatriya, Vaishya and Shudra) and untouchables are represented. The social structure of Newars is unique as it is the last remaining example of a pre-Islamic North Indic civilisation in which Buddhist elements enjoy equal status with the Brahmanic elements.
According to various historical sources, even though the presence of varna and caste had been known as an element in the social structure of the Kathmandu Valley since the Licchavi period (c., 3rd century CE), majority of the residents of the Nepal Valley were for the first time codified into a written code only in the 14th century in the Nepalarastrasastra by the Maithil–origin king Jayasthithi Malla (1354–1395 A.D.) Jayasthithi Malla, with the aid of five Kānyakubja and Maithil Brahmins whom he invited from the Indian plains, divided the population of the valley into each of four major classes (varna)—Brahmin, Kshatriya, Vaishya, Shudra—derived from the ancient Hindu text Manusmriti and based on individual's occupational roles. The four classes varna encompassed a total of 64 castes jat within it, with the Shudras being further divided into 36 sub-castes. Various existing and immigrant population of Kathmandu Valley have assimilated among the four varnas accordingly. It is believed that most of the existing indigenous people were incorporated under the Shudra varna of farmers and working-class population. Similarly, notable examples of immigrant groups being assimilated include the Rajopadhyaya Brahmins, who are the descendants of the Kānyakubja Brahmins of Kannauj who immigrated to Kathmandu Valley as late as the 18th century CE. The dozens of noble and ruling clans (present day Chatharīya Srēṣṭha) who came along ruling kings or as part of their nobility (most notably with Maithili Karnata King Hari Simha Deva (c. 1324 CE)) were also assimilated in the Newar nation in the Kshatriya varna. The Khadgis (Nāya/Kasaī), Dhobis (Kapali), Halwais (Rajkarnikars) among other caste groups are also believed to have immigrated to Kathmandu Valley from the southern plains.