Character alignment has its origin in Dungeons & Dragons. Since I've never played it, I don't know how it factors into the game. I do know, however, how I use it in my own writing.
Essentially, character alignment places a character into one of nine categories. These categories range from Lawful to Chaotic, and from Good to Evil. We end up with Lawful Good, Neutral Good, Chaotic Good, Lawful Neutral, True Neutral (Neutral Neutral), Chaotic Neutral, Lawful Evil, Neutral Evil, and Chaotic Evil. Here's a closer look at each type:
Lawful Good: These are the stereotypical "good guys". They want to do the right thing, and they want to do it within the boundaries of the law or other moral code. They believe in order above all else because they believe that order is inherently good. If you want to read more, TVTropes has you covered. Examples: Clark Kent, Steve Rogers, Ned Stark, Aragorn, Greg Lestrade, Hermione Granger (in the earlier books)
Neutral Good: These people are still want to do good above all else, but they're less concerned with maintaining absolute order and authority. They're willing to break the law to do what is right, but they don't turn into all-out rebels, either. They will ally with whoever they must (even an Evil type) in order to accomplish this. Read more. Examples: Hermoine Granger (in the later books), Will Turner, Gandalf, John Watson, Thor, Jon Snow
Chaotic Good: While these characters strive for good above all else, they have little care for law and order. They readily (and often) break rules if it enables them to do the right thing. They are considered "free spirits", and play by their own rules while still working for the greater good. Read more. Examples: Tony Stark, Westley (from The Princess Bride), Mary Morstan, Bruce Wayne, Robin Hood, Holly Short, Peter Parker
Lawful Neutral: Where Lawful Goods value good higher than anything (even the law), Lawful Neutrals value order more than anything else. They will do whatever it takes to preserve this order, whether it be Good, Evil, or neither. They follow their own code of "order", independent of any sense of "greater good". Read more. Examples: Stannis Baratheon, Zoe Washburne, Foaly, Mycroft Holmes, Boromir, Reyna Ramírez-Arellano
True Neutral: True Neutrals are perhaps the hardest to explain, because, by their very definition, they lack a standard set of characteristics. A True Neutral will ally with anyone, Good, Evil, or Neutral, for whatever cause. They might waver between opposing forces, pick the winning side for victory's sake, or pick a side for no real reason whatsoever. They are likely looking out for themselves and no one else (which does not restrict them from caring about others). Read more. Examples: Tyrion Lannister, Han Solo (at first), Dom Cobb (from Inception), the Ents, Diana (from Gone), Angela (Eragon)
Chaotic Neutral: The Chaotic Neutral isn't pure enough to be Good, but they aren't dark enough to be Evil, either. They obey no laws (unless it suits them). Essentially, they do whatever is in their own best interests in whatever way they see fit. They might swing between sides like a True Neutral, but they're much more unpredictable about it. Read more. Examples: Bruce Banner, Lady MacBeth, Jack Sparrow, Hamlet, Arya Stark, Sherlock Holmes (both the Benedict Cumberbatch and Robert Downey Jr. versions), Daenerys Targaryen, Murtagh
Lawful Evil: A Lawful Evil's moral compass clearly points away from good, but they're organized about it. They follow a strict set of rules (their own), and can be expected to behave in predictable patterns. They can often be found establishing themselves as a dictator or other type of lawful ruler, forcing their own rules onto the people. Read more. Examples: Darth Vader, Two-Face, Dolores Umbridge, Lucius Malfoy, Queen Gertrude (Hamlet), Galbatorix, Artemis Fowl (in the earlier books)
Neutral Evil: Like the Lawful Evil, the Neutral Evil's morals are questionable at best and nonexistent at worse. What separates them is the fact that they have less need for law and order. They don't follow a strict code, internal or external, like a Lawful character will. They will follow laws that suit their evil plan, but breaking rules doesn't bother them. Where Lawful Evil character still care about imposing order (as long as its their own order), Neutral Evils are just looking out for themselves. Neutral Evils often tend to be former True Neutrals who have sunk down the scale. Read more. Examples: Petyr Baelish, Bane, Cersei Lannister, MacBeth, Irene Adler, the Scarecrow
Chaotic Evil: These characters are probably the first to come to mind when someone mentions "evil". They are the embodiment of the line "Some men just want to watch the world burn" (The Dark Knight). They are the classic villain. In most cases, they're evil simply because they enjoy it. They have no rules, they're unpredictable, and they follow no logical path. They often destroy for the sake of it, and they revel in chaos. You might be able to reason with a Lawful or Neutral Evil, but if you come up against a Chaotic Evil, you should probably just start running. Read more. Examples: The Joker, Loki, Mal's projection in Inception, Jim Moriarty (Andrew Scott's version), Joffrey
In all of this, it is important to remember the distinction between Good and good, Evil and evil. An Evil character is not necessarily "bad" to the core. Often, it's more that their methods are questionable, rather than that their goal is morally wrong. Lowercase evil implies an intrinsic badness or wrongness; uppercase Evil is more about sketchy morals than anything else.
It's also important to remember that assigning character alignments can be subjective, and that alignments can change throughout a book, series, movie, etc. Many characters could be interpreted different ways, and some walk a thin line between two alignments. As such, my alignment placings are partially based off my own opinions and interpretations, and are therefore not set in stone. I welcome debate on the subject, and I'm open to rearranging characters if a convincing reason is presented. I am not, however, going to tolerate comments that say that a placing is just plain wrong with no supporting evidence.
Why is this important? What can I do with these alignments? Ultimately, an alignment is less about one specific character in themselves (though this is important) and more about this character's relation to others. If you know the alignments of your characters, you have already laid out the skeleton of their relationship and interactions. For example, my current work in progress has two point-of-view characters: a Lawful Good and a Chaotic Neutral. As such, these characters constantly clash. My LG prides himself in being honest, rule-abiding, orderly, and morally sound. My CN's main traits are unpredictability, impulsiveness, and lack of a concrete rule or moral system. This creates friction between the two, since they tend towards opposite ends of the Order/Chaos scale, and since one works for the common good (about which the other couldn't care less).
Even between characters on the same end of the Good/Evil axis will clash if they sit at different places in the Order/Chaos range. A good example of this is the constant clash between Harry and Ron's Neutral Good and Hermione's Lawful Good in the first Harry Potter book. Harry and Ron have no problem sneaking into the library, breaking curfew, etc., while Hermione is the only one concerned about the rule-breaking. ("We could be killed--or worse, expelled!") A Lawful Evil might be frustrated with his Chaotic Evil henchman's inability to follow orders. The possibilities are vast, and they're fun to play with in your stories. It's just a matter of finding the differences, and exploiting them.
For reference, here are some alignment charts that lay out the nine alignments and assign roles to characters from a specific book/movie/whatever: Firefly, Harry Potter, countries (just go with it...), The Princess Bride, Sherlock, Christopher Nolan's Batman trilogy
How do you use character alignment in your writing? What alignments are your characters? Are there good examples of a certain alignment that I didn't mention?
Side Note: While I was thinking of examples for each alignment, I started wondering how certain biblical figures would fall on the scale. For example, when I first thought of Jesus Christ, my immediate reaction was "Lawful Good. Obviously." The more I think about it, though, the more I'd actually type Jesus as Neutral Good. Yes, he's working for order and good. But actions like flipping the tables in the temple and going against the Roman government enough to attract negative attention are not the actions of a Lawful Good. Still, he's too much of a pacifist to ever come close to Chaotic anything. So, Neutral Good. Thoughts, anyone?