Mostly caste by birth has happened during Smriti period which is 200 BCE to 200 CE. There is also genetic evidence –
In Vedic time, caste was A self-declared system and later converted to hereditary system. Our Veda (the Sruti), the only Hindu authority, does not mention anything on caste system. It just mentions (for example Rig Veda Purusa Sukta – brahmanosya mukhamasit, bahu rajanyah kritaha, uru tadasya yadvaishyaha, padhyagam shudro ajayata etc) four keywords (called Varna, color, class) Brahmana, Kshyatriya, Vaisya and Shudra with their definition based on Guna-Karma. This is also called Svabhavaja Karma or action based on mental inclination. Later texts like Mahabharat, Gita(Sloka 4.13 – Chatur Varnyam Maya Sristam Guna Karma Vibhagasah) also defines these keywords based on Guna-Karma.
Veda and Gita ‘do not’ command to divide the society based on Guna-Karma. People choose this as a formula to divide the society. Other formula could have been based on economy (high class, middle class, low class) as it is done in USA. Due to advancement of technology, we can think of dividing people based on genetic pattern. Twenty-three human chromosomes can provide all details of mental, psychological inclination of a person.
Unfortunately there are smritis(e.g. Goutama smriti, Manu Smriti etc) which say such fierce words as these: “If the Shudra hears the Vedas, fill his ears with molten lead, and if he remembers a line, cut his tongue out. There is no purification rites for Sudra.” This is diabolical old barbarism no doubt. These books are not aligned to Veda. However people thought that Smriti is a Hindu scripture. But those are not. During 200 BCE these kinds of Smritis were written to suppress Vedic Varna system. Unfortunately those books are instrumental in diving people till date. Link –