Mirror Morality Machine

Usually, "if you can't beat 'em, join 'em" is standard... but what if you could make them join you? This is what a lot of Saturday Morning Cartoon villains have thought, anyway, and built a spell, artifact or machine that can invert the target's morality like a mirror. The hero subject to the Mirror Morality Machine will suffer a Face Heel Turn and go over to the bad guy's side. The Character Alignment of the hero will go from Good to Evil and Lawful to Chaotic. Alternately, it may simply "suppress" his conscience and give his ego free rein to do whatever mischief he wants. Usually this results in cheeky but harmless misanthropic antics, despite the villain's darker intentions.

Usually the effects of the machine will have a time limit, after which its effects will wear off and the hero has to clear his name for all the things he's done. However, his Sidekick will usually stop him before he does anything really bad and reverse the effects... or the bad guy will do it voluntarily because the hero is a better villain than he is! This applies when the machine is not an Instant Allegiance Artifact, and the hero-turned-villain turns on his "boss".

Of course, this being a morality-reversing ray, if the hero turns it on the villain, the villain will spend the rest of the episode as a contrite, cheerful and helpful soul. Sadly, It Only Works Once and the heroes can't keep dosing the bad guy, something about it being "immoral" or something. Most of the time.

The artifact version is Instant Allegiance Artifact. Compare Morality Dial.

Anime and Manga

 * Akazukin Chacha: "Red Riding Hood" Chacha does this repeatedly to an assortment of good guys and villains. Evilness is (usually) visually signified by black and purple eye makeup, which vanishes if a person is de-eviled.
 * Soul Eater: Soul has one of these in the form of Arachnaphobia's creatively named 'Morality Manipulation Machine', which causes Kim and Jackie have issues with inhibitions and moral dilemmas like 'not trying to kill friends with fire'.
 * Tezca Tlipoca has another ability that seems to work by making people see him as whoever they feel the most guilt about wronging. Medusa sees him as Chrona, while
 * Sailor Moon has versions of this in the first, second, and fifth seasons - which are not 100% effective when used on the main characters:

Comicbooks

 * The Fantastic Four villain, the Wizard, has a gizmo like this (he doesn't use it that often). He once used it to turn the Thing bad, but of course it didn't last. Decades later, he used it to turn the reformed Sandman back into a bad guy.
 * One reason he doesn't use it more often (although it'd been around for a while by that point) is that he tried it on the Thing again shortly after Johnny Storm's wedding. However, by that time the Thing had gotten Darker and Edgier--essentially, he was already enough of a "bad person" that the device had no effect. It also may not have helped that the Wizard was about to use it on Franklin Richards.

Literature

 * The early Doc Savage stories had the titular Doc rehabilitate criminals through "delicate brain surgery." You can sure as hell bet that wasn't in the later versions.
 * Evil By Necessity: The major unethical act of the main 'good' wizard in this story is to invent a spell which brainwashes the evil out of villains, permanently. (Not a spoiler because it's explained in the first chapter or so.)
 * The Wheel of Time has a magical method of turning channelers to the Dark against their will using 13 Black sorceresses channeling through 13 Fades. This causes previously good characters to realize that Evil Feels Good and start serving the Shadow. It is not known if this process is reversible, but the implication is that it isn't.

Live Action TV

 * Played with on The Mentalist. When Patrick Jane's former psychiatrist asks for his help, he and the CBI agents investigate a murder at a college campus. Jane meets with a group of researchers who are investigating human morality by testing a machine on human subjects. The machine sends impulses to the morality center of the brain, which the researchers believe will turn "evil" on and off at their discretion. Jane finds out that the results have been falsified, and the machine does nothing. This was done to keep the truth from the head researcher so that he will keep funneling money into the university. Jane's gambit near the end is to make the team believe that they have succeeded. Jane's psychiatrist friend uses the machine on him to turn him evil, but doesn't turn him back, so when Jane takes a gun and confronts the chancellor of the university, everyone not in on the con believes that he will kill because he has no morality to keep him from doing it. He shoots his friend (with blanks, of course), causing the murderer to confess in a panic.
 * The Ark of Truth in Stargate SG 1 causes morality realignment in the Priors by revealing the truth that the Ori are false gods.

Newspaper Comics

 * The Flash Gordon comic strip once had a storyline in which Ming the Merciless invented a device along these lines, which was turned on him in the end; he became a cheerful, friendly individual (with hair!) who immediately agreed to become Prince Barin's "guest". The effect actually lasted a considerable period of time, allowing the writers to take Flash on a variety of different, non-Ming-related adventures for a while.
 * Bloom County's Steve Dallas had his brain "Gephardtized" and became a sensitive, new age guy.

Tabletop RPG

 * There was a Dungeons and Dragons item called the Helm Of Opposite Alignment that did this to whoever wore it. It was speculated that if it were to be put on the head of an angel-equivalent, all of creation would be in trouble.
 * Fortunately, the angel-equivalents have pretty good Will saves, at least in 3.5.
 * What makes the helm dangerous is that it isn't a temporary effect - the alignment change is permanent even after the helm is removed. What's more, even though the victim usually knows what happened, the change is thorough enough that they enjoy their new alignment and view the prospect of going back to their old ways with horror.
 * In the first edition Dungeons and Dragons, Oriental Adventures supplement, the spell Compel allowed the shukenja casting it to change the alignment of the target creature to whatever he wished, including the exact opposite.
 * The Book of Exalted Deeds has a spell called Sanctify the Wicked that traps an evil being in crystal and forces them to undergo evil-eradicating therapy over the course of a whole year. Once the spell ends, the creature is now good, having all their evil (and evil abilities, if any) trimmed away and replaced with goodness. (Plus some level adjustment, even if it lost more stuff than it gained.) This even works on Always Chaotic Evil beings like demons.
 * Its sister supplement, The Book of Vile Darkness, has the spell Morality Undone, which turns a character or creature evil. The spell's description specifies that they don't turn against their friends instantly, but it does make spells like Suggestion or Charm Person much more flexible (those spells only let you suggest actions that are within a person's nature).
 * A certain mace in D&D requires its wielder to roll Will saves or become chaotic evil. It also requires being bathed in blood every day or else it stops having any magic effects. And when you realize that a mace is a cleric's weapon...

Video Games

 * Nethack, being loosely based on Dungeons and Dragons, also included the Helm of Opposite Alignment. Although it's not permanent in this game.
 * Though nine times out of ten the actions of a lawful character and a chaotic character are the same anyways, unless you make a habit of using poisoned weapons. The main effect of switching alignment is to lose all your divine protection (permanently, because the gods are jerks), and to allow you to use altars of a different alignment.
 * A text adventure centered around your attempts to escape from such a machine. The final reveal was that.
 * Perfect Dark has the Psychosis Gun, which essentially polarizes the morality of Mooks to make them sidekicks.

Western Animation

 * In the Beast Wars episode "Dark Designs," this was how Megatron turned Rhinox evil. Fortunately, it could undo itself, which Megatron was grateful for when that action turned out to be a bad idea.
 * And then, in Transformers Generation 1, there was Megatron's "personality destabilizer device" from "Day of the Autobots," which turned nearly all of the Autobots evil, until their human sidekicks worked up a reversal device.
 * Megatron has a loooooooong history of these things, since "The Secret of Omega Supreme" reveals he had one about nine million years ago, inaptly christened the Robo-Smasher, what with it not actually smashing anything. He used it to corrupt the then-good Constructicons, and then tried to use it on Omega Supreme. Omega managed to destroy it halfway through his own reprogramming, with the effect of turning him permanently into a Tin Man (pardon the double-meaning) with anger issues. Megs apparently was never able to rebuild the sucker.
 * One of these appears in Kim Possible. Specifically, it switches Ron's and Doctor Drakken's morality; Ron becomes a much more competent villain than Drakken ever was, and Drakken becomes nice. A later episode upgrades it to a straight morality reversing ray, resulting in people's alignments getting flipped left and right. No villain-Kim though.
 * Probably because she would have won, ending the series rather unconventionally for a children's cartoon.
 * Alternate theory: we've seen Evil Kim. It's Bonnie.
 * Done on Xiaolin Showdown - going through to the alternate world with either the Yin Yo-Yo or Yang Yo-Yo, but not both combined, switches the morality of the user upon re-entry to the "real" world.
 * It was hilariously abused in one episode, when Kimiko and Wuya fought in Showdwon using one of yo-yo's each. They were changing alignments so much and so fast it's a miracle they come out with their original personalities at the end.
 * When Omi is mirrored, he seems mostly interested fighting for it's own sake. Chase Young comments that "Omi's dark side doesn't seem to be all that... dark.".
 * After using the Yang Yo-Yo, Jack Spicer is nice to the point of being annoying to the protagonists, and later voluntarily uses the Yin Yo-Yo to help his new friends, even though he knows it will turn him evil again.
 * Silverhawks had a cosmic alignment reverse the heroes' and villains' morality, which resulted in Mon-Star and his gang using The Power of Friendship (or better teamwork compared to the now squabbling and villainous Silverhawks) to beat them and put the Silverhawks behind bars! Amusingly, Mon-Starr and his gang grow bored of not having any more bad guys to catch, and then the effects wear off and they start their petty crimes again with the Silverhawks safely behind bars.
 * Care Bears Adventures in Care-a-Lot: Grizzle accidentally created one of these. He sent a robot with an Eraser Ray down to Care-a-Lot to get rid of the Care Bears' belly badges, but instead, the ray flipped the badges, making the bears only care about their personality trait, causing them all to fight with each other instead of getting along.
 * The Care Bear Stare itself acts as this from time to time, filling the target with good feelings that make them forget their evil ways. It wears off after a while, apparently.
 * In Phineas and Ferb, Dr. Doofenshmirtz created a Turn-Everything-Evil-inator in order to make Perry the Platypus his ally in "Day of the Living Gelatin." Perry turned out to be too nimble to be hit, but a number of other things were hit, including a bar of soap, a toothbrush, and a swimming pool full of jell-o.
 * Also, the Misbehavinator from "Got Game?" ended up being one of these, though probably not intentionally. Created to make the other dogs at a dog show misbehave, it also made Buford (accidentally hit by it) admit to Isabella that he was wrong, prompting Ferb to comment, "That was completely out of character."
 * Bionicle: The evil scientist Makuta, Mutran, created mutant Shadow Leeches so that they can drain a target's moral light. Takanuva was partially affected, but still retained his moral self and the additional powers over shadow. Fortunately, all those affected were cured by the screech of a bat-like Klakk
 * An Earthworm Jim episode featured a device that created an opposite duplicator. Evil Jim tries to create an evil Five Man Band out of Jim's True Companions, but finds out the inherent problems with it when Action Girl Princess Whatshername becomes a useless evil Valley Girl, mild-mannered Peter Puppy (who transforms into a rampaging beast) becomes a sociopath who turns into a Gentle Giant, and Evil Jim ends up getting hit numerous times, creating an army of Jims.
 * The Cat Catcher in Cat City is this. It is a huge metallic bulldog that eats mean, wild, murderous, mouse-eating cats and shits cute, peaceful kittens. In the sequel we learn that the bows on the cats' tails are responsible for the change.
 * McNasty's "Mean Machine" in The Legend Of Big Paw.