An antihero can mean one of a number of things.
In Film an antihero is typically a flawed hero who tries to do good, but doesn’t really live up to the roles and expectations of a genuine Hero.
Rick Blaine (Humphrey Bogart) in Casablanca to some is an antihero, but to others he is a genuine hero.
It is very subjective.
Another popular cinematic antihero is Clint Eastwood in Sergio Leone’s Fistful of Dollars. Clint played an outlaw as “Blondie” in the dollars Trilogy, while he played a lawful antihero in Dirty Harry.
But in the Dirty Harry sequels Clint increasingly became an un-lawful (rather than lawful) anti-hero, he became more of a vigilante with a badge.
Some actors are typically known for playing antiheroes like Lee Marvin, Charles Bronson , Kurt Russell etc while other actors such as John Wayne are known primarily for playing morally decent heroes.
An antihero in comic books such as Spawn, Judge Dredd Wolverine or The Punisher is neither good nor evil. Hero nor villain.
Comic books antiheroes often fall on the side of “good” in the moral compass.
They may be vigilantes like Batman who is both a genuine hero and antihero with a moral code – he does not kill nor use guns.
Wolverine is another antihero with a moral code, who tries to kill only bad people, but sometimes ends up killing the wrong people, or gets brain washed by Hydra to kill other heroes pushing him temporarily into villain territory.
Antiheroes may be criminals who are morally decent, and are reluctant heroes such as Catwoman who are mainly interested in crime, but not at the expense of the poor. She steals from the rich, and often from rich morally repugnant criminals such as the mafia who are killers and slave traders.
A true villain or super-villain is out for a particular agenda, or to serve themselves, thus are not anti-heroes. If someone benefits by the villains actions, it’s usually incidental. But some characters walk a constant line from Villain to Anithero and back again. The X-Men’s Magneto for example started as a villain but has been at times Villain, Hero, Anti-Hero and even a genuine savior to Mutants for brief periods of time.
Some characters waver between being a hero, antihero and villain, such as Deadpool, who is a mercenary and does not pretend to be a hero.
While Deadpool is a mostly an amoral killer mercenary who accepts contracts for money, he doesn’t want to kill children, and he has teamed up with Wolverine and other X-men characters just as many times as he has fought against them. Despite being amoral, even a mentally ill maniac and basically he does not accept societies values and expectations, but he does have his own style and values he lives by, just don’t expect those value to match up to your own.
Deadpool has also teamed up with other characters like Spider-Man and other Marvel heroes, but often betrays them or uses them to help him complete his mercenary contracts.
An antihero then can actually be :
*A former hero
*A pure anti-hero – like the Punisher
*A reformed villain – like Hawkeye who has been a villain, hero and antihero
Even Captain America has been an antihero in the Marvel Civil War story when he went against the compulsory government superhero registration act.
For more on this topic and further examples check out the TV Tropes website, it’s a great resource for fun short reading and really valuable for doing research for articles and podcasts and what have you on niche topics.
This alignment meme grid you may find helpful for practical examples of the contrast of heroes, anti-heroes and villains. All of whom can be Good / Neutral / Evil etc, and may shift into different alignments in different stages of their career in their given lifespan or fiction.