The Texas Penal Code is the principal criminal code of the U.S. state of Texas. 
It was originally enacted in 1856 and underwent substantial revision in 1973, with the passage of the Revised Penal Code, in large part based on the American Law Institute's Model Penal Code.

History
The first codification of Texas criminal law was the Texas Penal Code of 1856. Prior to 1856, criminal law in Texas was governed by the common law, with the exception of a few penal statutes.
In 1854, the fifth Legislature passed an act requiring the Governor to appoint a commission to codify the civil and criminal laws of Texas. 
Only the Penal Code and Code of Criminal Procedure, both authored by James Willie, were passed by the sixth Legislature and were effective as of February 1, 1857. 
These came to be referred to as the "Old Codes."

The code underwent a major reorganization and reconciliation of existing criminal laws with the adoption of the Texas Penal Code of 1974.

According to the Texas Legislative Counsel, the main objectives of the Revised Penal Code were to 
(1) consolidate, simplify, and clarify the substantive law of crimes; 
(2) modernize a Penal Code designed for the preindustrialized, rural, and underpopulated Texas society of a century ago; 
(3) identify and proscribe, with as much precision as possible, all significantly harmful criminal conduct; 
(4) rationally grade offenses, according to the harm they cause or threaten, and sensibly apportion the sentencing authority between the judiciary and correctional system; 
(5) codify the general principles of the penal law; and 
(6) collect in a single code all significant penal law, transferring to more appropriate locations in the statutes regulatory and similar laws that merely employed a penal sanction.

Dean W. Page Keeton of the University of Texas played a key role in drafting, revising, and promoting the Revised Penal Code.

Organization
The Texas Penal Code is organized into titles and chapters. As of 2017, the basic structure is as follows:

Title 1: Introductory Provisions - Declares that all persons are presumed innocent unless proven guilty beyond a reasonable doubt.
Chapter 1. General Provisions
Sec. 1.02 states the objectives of the penal code: "to establish a system of prohibitions, penalties, and correctional measures to deal with conduct that unjustifiably and inexcusably causes or threatens harm to those individual or public interests for which state protection is appropriate" through deterrence, rehabilitation, and punishment of convicted persons; by giving fair warning of prohibited conduct and consequences of violation; to prescribe penalties proportionate with the seriousness of offenses and take rehabilitation potential into consideration; "to safeguard conduct that is without guilt from condemnation as criminal"; to guide and limit law enforcement; and "to define the scope of state interest in law enforcement against specific offenses and to systematize the exercise of state criminal jurisdiction."
Sec. 1.03 provides that conduct not prohibited by law is not a criminal offense.
Sec. 1.04 through Sec. 1.09 cover: construction of the code (according to fair import of terms), computation of age, definitions, preemption (prohibiting political subdivisions from enacting or enforcing laws criminalizing same conduct as criminalized in Penal Code), and concurrent jurisdiction for offenses involving state property (granting Attorney General concurrent jurisdiction to prosecute if local prosecutor consents).
Chapter 2. Burden of Proof
Sec. 2.01 provides that all persons are presumed innocent unless each element of the offense alleged is proved beyond a reasonable doubt.
Sec. 2.02 provides that the prosecutor must negate the existence of an exception where an exception is specifically stated in the statute.
Sec. 2.03 provides that it is not the prosecutor's duty to disprove a defense and that the jury will not be instructed regarding any defense unless evidence is admitted to support the defense, and that if the defense is submitted to a jury, then the jury will be instructed "that a reasonable doubt on the issue requires that the defendant be acquitted."
Sec. 2.04 provides the standard for affirmative defenses, which is essentially the same as for non-affirmative defenses except that the jury is instructed "that the defendant must prove the affirmative defense by a preponderance of evidence."
Sec. 2.05 covers presumptions and requires that "if there is sufficient evidence of facts that give rise to the presumption, the issue of the existence of the presumed fact must be submitted to the jury, unless the court is satisfied that the evidence as a whole clearly precludes a finding beyond a reasonable doubt of the presumed fact."
Chapter 3. Multiple Prosecutions
There is no Chapter 4 or Chapter
Title 2. General Principles of Criminal Responsibility
Chapter 6. Culpability Generally
Covers concepts such as mens rea and actus reus.
Chapter 7. Criminal Responsibility for Conduct of Another
Covers complicity and corporate liability.
Chapter 8. General Defenses to Criminal Responsibility
Covers the insanity defense, mistake of fact, mistake of law, intoxication, duress, entrapment, and the responsibility and capacity of minors, including minors with mental illness.
Chapter 9. Justification Excluding Criminal Responsibility
Covers self defense, defense of others, public duty, necessity, suicide prevention, defense of property, lawful arrest, and child discipline.
Title 3. Punishments
Chapter 12. Punishments
Prescribes available punishment according to classification of the offense (Class A misdemeanor, Class B misdemeanor, Class C misdemeanor, capital felony, first-degree felony, second-degree felony, state jail felony) along with aggravating circumstances (repeat and habitual offenders, hate crimes, elder abuse, narcotics, and crimes committed in a disaster or evacuated area [e.g., looting]).
Title 4. Inchoate Offenses
Chapter 15. Preparatory Offenses
Covers criminal attempt, criminal conspiracy, and criminal solicitation.
Chapter 16. Criminal Instruments, Interception of Wire or Oral Communication, and Installation of Tracking Device
Covers wiretapping, unauthorized computer network penetration, etc.
Title 5. Offenses Against the Person
Chapter 19. Criminal Homicide
Covers murder, capital murder, manslaughter, and criminally negligent homicide.
Chapter 20. Kidnapping, Unlawful Restraint, and Smuggling of Persons
Covers false arrest, kidnapping, ransom, and human trafficking.
Chapter 21. Sexual Offenses
Covers child sexual abuse, homosexual conduct (declared unconstitutional by Lawrence v. Texas in 2003), public lewdness, indecent exposure, bestiality, indecency with a child, sexual relationships between students and teachers, secret photography, unlawful disclosure or promotion of intimate visual material (see revenge porn), voyeurism, and sexual coercion (see webcam blackmailing).
Chapter 22. Assaultive Offenses
Covers assault, sexual assault (including rape, child rape, date rape and drug-facilitated sexual assault, etc.), and aggravated assault (includes assault with a deadly weapon, assault on a public servant, witness tampering, and drive-by shootings)
Title 6. Offenses Against the Family
Chapter 25. Offenses Against the Family
Covers bigamy, incest, interference with child custody, criminal nonsupport, harboring a runaway child, domestic violence, trafficking of children, etc.).
Title 7. Offenses Against Property
Chapter 28. Arson, Criminal Mischief, and Other Property Damage or Destruction
Also covers vandalism and graffiti.
Chapter 29. Robbery
Chapter 30. Burglary and Criminal Trespass
Chapter 31. Theft
Consolidates as simply "theft" distinct charges previously known as theft by false pretext, conversion by a bailee, theft from the person, shoplifting, acquisition of property by threat, swindling, swindling by worthless check, embezzlement, extortion, receiving or concealing embezzled property, and receiving or concealing stolen property. Also covers theft of trade secrets, vehicle theft, signal theft, EAS shielding and deactivation instruments (see booster bag), skimming, cargo theft, and petroleum theft.
Chapter 32. Fraud
Covers forgery, counterfeiting, carding, fraudulent loan applications, lottery scams and fake sweepstakes, essay mills, identity theft, etc.
Chapter 33. Computer Crimes
Covers hacking, phishing, online solicitation of a minor (see, e.g., To Catch a Predator), denial-of-service attacks and other cyber-attacks, ransomware, computer viruses, cryptovirology, etc.
Chapter 33A. Telecommunications Crime
Covers phone fraud, caller ID spoofing, etc.
Chapter 34. Money Laundering
Chapter 35. Insurance Fraud
Chapter 35A. Medicaid Fraud
Title 8. Offenses Against Public Administration
Chapter 36. Bribery and Corrupt Influence
Chapter 37. Perjury and Other Falsification
Chapter 38. Obstructing Governmental Operation
Chapter 39. Abuses of Office
Title 9. Offenses Against Public Order and Decency
Chapter 42. Disorderly Conduct and Related Offenses
Chapter 43. Public Indecency
Title 10. Offenses Against Public Health, Safety, and Morals
Chapter 46. Weapons
Chapter 47. Gambling
Chapter 48. Conduct Affecting Public Health
Chapter 49. Intoxication and Alcoholic Beverage Offenses
Covers driving, flying, and boating while intoxicated, vehicular manslaughter, etc.
Title 11. Organized Crime
Chapter 71. Organized Crime
Covers mafias, street gangs, crime bosses, etc.