The Black Codes, also called the Black Laws, were racially segregationist and discriminatory U.S. state laws that limited the freedom of black Americans but not of white Americans. The first Black Codes applied to "free Negroes", i.e., black people who lived in states where slavery had been abolished or who lived in a slave state but were not enslaved. After chattel slavery was abolished throughout the United States in 1865, former slave states in the U.S. South enacted Black Codes to restrict all black citizens, especially the emancipated freedmen who no longer were subject to control by slaveholders.
Since the colonial period, colonies and states had passed laws that discriminated against free blacks. In the South, these were generally included in "slave codes"; the goal was to suppress the influence of free blacks (particularly after slave rebellions) because of their potential influence on slaves. Free men of color were denied the vote in the North Carolina Constitutional Convention of 1835. Laws prohibited activities such as bearing arms, gathering in groups for worship, and learning to read and write.