NOTE: This spoiler was sent in by Jennifer.

Walter Sparrows (Jim Carrey) is an animal control officer. He has a son Robin and a wife Agatha (Virginia Madsen), who owns a cake shop. The film flashes back to Walter's Christmas party. Agatha didn't show up because she was sick and Walter went because Agatha made a cake for the party. At the party he is hit on by a coworker whom he rejects.

The movie begins again in the present with Walter bored at work and it's almost time to go home when the coworker he rejected calls him over the radio and makes him go on a call to catch a dog. He tracks the dog to the back of a restaurant. He starts telling the dog a story and manages to get a leash around the dog's neck. He then looks at the dog's leash and sees his name is NED. Walter gets distracted because the light from the leash shines in his eyes and the dog bites his arm and runs away to a cemetery and sits on a grave. Walter wants to shoot the dog with a tranquilizer but the dog gets away.

Walter says in a voice over that if he hadn't been rude to the coworker, she wouldn't have sent him on that call and he wouldn't have been late to meet his wife. Because it is while she is waiting that she sees the book The Number 23 and buys it for him.

Walter starts reading the book and sees some similarities between him and the main character Fingerling. The main character explains how he got the name Fingerling from a book and Walter discovers he has the same book. Fingerling lived next door to a woman who got murdered and from then on he wanted to be a detective instead of an accountant like his dad. He grows up and meets Fabrizia, who gets turned on whenever Fingerling pretends to stab her. Fingerling then goes to try and stop Suicide Blonde from hanging herself. She then goes on to tell him about her father who killed her mother then himself all because of the number 23. He hoped to end the curse but then she began seeing the number 23 in everything. I can't remember why but pink is also associated with the number 23.

Walter tells his wife and son about everything that adds up to 23 or to 32, which is 23 in reverse. Walter goes to see Dr. Isaac French who he hopes will tell him what the number 23 means. The dr. tell him that it doesn't mean anything and people give it meaning. That you can see the number 23 in everything and he gives examples. The dr. says he will talk to Agatha, who is already worried about Walter's behavior.

Fingerling's story continues. In the story, Fingerling talks to a friend, Dr. Miles Phoenix, who is wearing a pink tie. Miles says he will talk to Fabrizia. Well the Dr. ends up liking Fabrizia and sleeping with her. Walter starts to believe that Isaac is after Agatha and that Issac is evil because he was wearing a pink tie just like the character in the book. Walter thinks anything associated with the number 23 is evil because it adds up to 666, when divided or something like that.

Walter starts to have dreams of killing Agatha just like Fingerling does in the book. Walter has such a vivid dream that he leaves the house in the middle of the night, goes to the King's hotel (something like that) and checks into the room 23 so he can finish the book.

Fingerling stabs Fabrizia. Miles enters the room, sees her lying on the bed, hands tied to bedpost like always, picks up the clean knife on the floor and creeps over to the bed, ready to act out her fantasy again but then he sees she is dead and is arrested. The book stops on chapter 22 with Fingerling on a balcony deciding if he will jump.

Walter takes the book back to the bookstore and learns it is self published and the author never wrote a book after or before.

Walter sees Ned again and follows him to the grave of Laura Tollin who died when she was 23 and her body was never found. Walter looks into it and discovers Laura was sleeping with her professor and like Fabrizia, she liked to have the professor pretend to stab her. Walter thinks the professor wrote the book  and that it's his confession so he visits him. But the professor says he didn't kill Laura and that he didn't write the book and if he did he'd use a better name then top secret. (Top Secret is what the author's name spells out when the name is unscrambled.)

Robin finds out that there is a P.O. Box hidden in the back of the book and they decide to send 23 boxes filled with foam popcorn to the P.O Box. There they see Dr. Nathaniel, who freaks out and slits his neck. Agatha stays with him and orders Walter to take Robin home. Inside Nathaniel's pockets she finds an ID card to a mental Institute but she tells Walter she found out nothing from the Dr. She goes to the abandon institute and sees a room where the walls are scribbled with the number 23, she then sees a long box with Walter's name on it.

Meanwhile Robin and Walter learn that every 23 word on every 23 page spells out a message. I don't remember exactly but it tells them to go to the stairs to heaven which is a place in the park. Under the 23rd step is the bones of Laura. Robin and Walter drive away find a pay phone and call the police, who find no bones. Agatha and Issac show up. Agatha, Robin and Walter drive home and see Ned in the street. Walter speeds up to kill the dog but stops. Agatha grabs his arm when he stops and he sees her hands have dirt on them.

At home she washes her hands and he realizes she took the bones and that her maiden name is pink. He thinks she wrote the book but she explains he wrote the book. She takes him and robin to the institute where Walter explores the contents of the box. There are detective comics, the manuscript and a saxophone. Fingerling played the sax but Walter didn't, or so he thought. There is also a broken piece of Laura's ankle bracelet which flashes across his face just like Ned's dog collar did in the beginning. Walter leaves freaked.

He returns to the hotel room 23 where he tears down the wallpaper and finds chapter 23 written on the wall explaining everything. Walter's father killed himself after Walter's mom killed herself. His suicide note was just pages of things that add up to the number 23. Walter loved Laura, who liked when he pretended to stab her. Walter was obsessed with 23 and Laura eventually sleeps with the professor. Walter ends up stabbing Laura after she said she never loved him and no one would ever love him. He buries her in the park and Ned sees him. Like in the book, the professor is arrested. Walter goes to the hotel room, writes the book then jumps off the balcony. He survives and ends up in the institute where Dr. Nathaniel reads the manuscript, publishes it and becomes obsessed with number 23.
Walter suffers memory loss because of the fall. The day Walter leaves the institute is the day he met Agatha.

Agatha finds him in the hotel room and says she loves him and that he was sick but he got well and he is not a bad person. He runs out and waits for a bus to kill him but sees Robin and can't do it. He realizes suicide is the easy way out.

The movie ends with Laura being buried and the professor at the funeral, a free man. Walter is about to be sentenced but he knows one day he will get paroled and their life will go on.