Fact: Contrary to popular misconception, the parties never "switched" on racism. The Democrats just switched from overt racism to a subversive strategy of getting blacks as dependent as possible on government to secure their votes. At the same time, they began a cynical smear campaign to label anyone who opposes their devious strategy as greedy racists.
Following the epic civil rights struggles of the 1960s, the South began a major demographic shift from Democratic to Republican dominance. Many believe that this shift was motivated by racism. While it is certainly true that many Southern racists abandoned the Democratic Party over its new support for racial equality and integration, the notion that they would flock to the Republican Party -- which was a century ahead of the Democrats on those issues -- makes no sense whatsoever.
Yet virtually every liberal, when pressed on the matter, will inevitably claim that the parties "switched," and most racist Democrats became Republicans! In their minds, this historical ju jitsu maneuver apparently transfers all the past sins of the Democrats (slavery, the KKK, Jim Crow laws, etc.) onto the Republicans and all the past virtues of the Republicans (e.g., ending slavery) onto the Democrats! That's quite a feat!
It is true that Barry Goldwater's opposition to the Civil Rights Act of 1964 probably attracted some racist Democrats to the Republican Party. However, Goldwater was not a racist -- at least not an overt racist like so many Southern Democrats of the time, such as George Wallace and Bull Connor. He publicly professed racial equality, and his opposition to the 1964 Act was based on principled grounds of states rights. In any case, his libertarian views were out of step with the mainstream, and he lost the 1964 Presidential election to LBJ in a landslide.
But Goldwater's opposition to the 1964 Civil Rights Act provided liberals an opening to tar the Republican Party as racist, and they have tenaciously repeated that label so often over the years that it is now the conventional wisdom among liberals. But it is really nothing more than an unsubstantiated myth -- a convenient political lie. If the Republican Party was any more racist than the Democratic Party even in 1964, why did a higher percentage of Republicans than Democrats in both houses of Congress vote for the 1964 Civil Rights Act? The idea that Goldwater's vote on the 1964 Civil Rights Act trumps a century of history of the Republican Party is ridiculous, to say the least.
A Short History of Democrats, Republicans, and Racism