The Code of Harry was never actually written down, but was passed down verbally. As a result, it's not a verbatim list of rules, but more a general set of learnings and guidelines taught by Harry to Dexter.
Dexter has several times cited two rules as the most important rule above all others:
- 1st Rule of the Code : Never get caught - Don't get caught committing a crime, since that would result in imprisionment and may even result in being put to death. Harry, in bringing Dexter to witness an execution, runs through what the number one rule is and states that the other rules are to prevent him from being caught.
- 2nd Rule of the Code : Never kill an Innocent - Make sure that the victim is a killer, for no condonable reason.
Dexter has been willing to bend both rules from time to time.
- There are other rules like
- Never make a scene.
- Fake emotion and normality to fit in.
- When taking a psychology personality test, always answer the question with the opposite of what you feel.
- Another less mentioned factor of the code is Dexter's victims must be killers who the police have been unable to catch or convict. Dexter seems to ignore this factor however, as he frequently sabotages cases in order to save the suspect for himself. On one occasion he even broke a convict out of jail so he could kill him himself (although the convict in question had been putting out hits on people even from behind bars).
Consequences when violating the Code
As Dexter has been seen violating his code multiple times, he runs the risk of bad things happening. One notable example is in episode 4x12, when he answered Rita's phone call, against Harry's warning. This led to him committing a hit and run, which then ultimately led to his ending up in jail, missing the chance to finish off Trinity.
Dexter also started a family against Harry's judgment. The main reasoning behind this is that they distract Dexter, as well as putting them in danger. This prophecy ultimately comes true at the conclusion of season four.
Several times, Dexter has refused to kill someone because they didn't fit Harry's Code - even if killing them would be greatly convenient:
- James Doakes - Dexter was willing to turn himself in as the Bay Harbor Butcher rather than kill Doakes, even after Doakes discovered his secret.
- Ellen Wolf - Dexter considered killing defense attorney Ellen Wolf when Miguel Prado argued that she put the guilty back on the streets. However, Dexter quickly decided she was just doing her job and did not fit the code.
- Ramon Prado - After Dexter killed Miguel, Ramon began to stalk him and tried to kill him. Dark Harry (The outward personification of Dexter's inner Dark Passenger) told Dexter that Ramon was a wild dog who needed to be put down, but Dexter refused to violate the code by killing Ramon and instead talked to him.
- Lumen Pierce - Dexter refused to kill her as it did not fit the code inspite that she witnessed him killing Boyd Fowler.
Dexter has only rarely killed someone who didn't follow the Code of Harry:
- Oscar Prado - Encountered him while trying to kill Freebo. Oscar attacked Dexter with a knife, and Dexter killed him in self defense.
- Nathan Marten - A pedophile targeting Astor.
- Camilla Figg - A mercy kill at her request, due to her terminally ill condition.
- Rankin - A rude man Dexter encounters in the bathroom a remote fueling station. Dexter flys into a rage and beats the man to death with an anchor. Dexter shows no regard for the fact that he knew nothing about the man and it is not shown if Dexter makes any effort to cover up the large amount of evidence left behind. The outburst is the first time Dexter is able to break free of the shock from Rita's death.
- Stan Liddy - A corrupt narcotics cop hired by Quinn to tail Dexter. After Stan kidnaps Dexter, he tries to force a confession out of him. Dexter kicks him in the face before Stan tries to stab him but Dexter fights back and kills him in self defense. It was unknown if Stan had a history of violence or murder outside of being a corrupt cop.
- Norm - A hotel manager and drug harvester who Dexter meets when he goes up to Nebraska to talk to Jonah. After Norm steals Dexter's tools after suspecting that he maybe a cop, he tries to blackmail Dexter because he thinks he's rich due to his car. At this point his dark passenger brother tells him to kill him which he did. This is the second kill Dexter has committed on impulse.
Dexter has only once mistakenly killed someone who wasn't a killer:
- Jonathan Farrow - Dexter killed a photographer whom he believed was killing his subjects, only to see his assistant confess.
- Dexter: (voiceover) There were so many lessons in the vaunted Code of Harry. Twisted commandments handed down from the only God I've ever worshiped. 1 through 10: Don't get caught. That I got covered. But, killing someone without knowing if he's guilty, I'd love some help on this one, but my God is dead now.
- Dexter: (voiceover) Not long ago I had a dream that people could see me for what I am, and for a brief instant in time the world actually saw my bodies of work. Some even cheered. But as it turns out, nobody mourns the wicked. Sorry James. I think Harry knew that from the start. That's why he gave me a code. It cost him his life, but it kept me alive through incredible trials. The code is mine now, and mine alone. So too are the relationships I cultivate. They're not just disguises anymore. I need them, even if they make me vulnerable. My father might not approve, but I'm no longer his disciple. I'm a master now, an idea transcended into life. And so this is my new path, which is a lot like the old one, only mine. To stay on that path, I need to work harder, explore new rituals, evolve. Am I evil? Am I good? I'm done asking those questions. I don't have the answers. Does anyone?
- Dexter: (voiceover) I built my life on Harry's code. I lived by it. But Harry lied. Why would he do that? What else don't I know? My concrete foundation is turning to shifting sand. Maybe Rudy was right. You never can truly know anyone.
- Dexter: (voiceover) My father taught me one thing above all others; to be sure. And I am. Matt Chambers, Miami is your last stop. If God is in the details and if I believed in God, he's in this room with me. I just wish he had brought an extension cord.
- Dexter has several times discussed aspects of the Code with victims he is about to kill. 
- Dexter almost never discusses the Code with any non-victims besides Harry. Notable exceptions are Brian Moser and Miguel Prado, both of whom he later killed.