Late in Kingdom Hearts, Sora becomes a Heartless for a short time, before being restored to his human form. In Kingdom Hearts coded, Sora's Heartless becomes a separate character, a digital entity created from the journal record of Sora's time as a Heartless. This Heartless serves as the main antagonist of the game and the source of the Bug Blox corruption. Unlike other Heartless, Sora's Heartless held onto his feelings, memories, and selfhood as a Heartless, and this unique trait is commented on by others.
After Sora, Donald, and Goofy track Riku down to the Great Hall, they learn that he has used the incomplete Keyblade of People's Hearts to summon the Keyhole of Hollow Bastion. He reveals that Kairi's lost heart has been within Sora all along, and that it must be released in order to complete the Keyhole. He moves to release Kairi's heart by using the Keyblade on Sora, but Sora parries at the last second, and eventually defeats Riku.
Despite this, Kairi is still catatonic, and Sora is unable to seal the incomplete Keyhole. In order to save Kairi, Sora turns Riku's Keyblade on himself. This releases Kairi's heart from Sora, reviving her, but also completes the Keyhole and casts Sora into darkness, transforming him into a Heartless, and releasing his Nobody, Roxas, as well as Kairi's Nobody, Naminé. Sora fades into a Shadow, as he does not have that much darkness in his heart, just as Kairi awakens, and the Heartless rapidly emerging from the Keyhole force Kairi, Donald, and Goofy to flee.
As a Shadow, Sora follows his friends through the Lift Stop to the Entrance Hall, where he sees them being overrun by other Shadow Heartless. He rushes to help his friends, and though Donald tries to attack him, Kairi recognizes him and embraces him. Her light and heart return Sora to his human form, and Sora later states that while a Shadow, he nearly forgot everything. Although restored to human form, Sora remains a pseudo-Heartless throughout his battle with Ansem, Seeker of Darkness.
When they first enter Castle Oblivion and learn of its alleged power over memories, Goofy reassures Sora by reminding him that he didn't lose his memories when he became a Heartless. Axel later explains to Larxene that this strange trait is what interests him about Sora. Sora and his friends eventually discover that the witch Naminé somehow has the ability to manipulate memories, allowing her to manipulate the memories of Sora and his friends.
Organization XIII are forcing her to do this in order to brainwash Sora at Castle Oblivion, but Sora defeats the Organization members within the castle and rescues Naminé. They agree that Sora will be put to sleep so that Naminé can restore his jumbled memories, and after Naminé puts Sora to sleep, she blanks the contents of Jiminy's Journal, as well as Sora and his friends' memories, then begins restoring them. However, while the memories were reconnected, the Journal itself remained blank. This is later revealed to be due to the record of Sora-Heartless beginning to assert itself.
One year later, Roxas dreams of when Sora was turned into a Heartless, as well as when Kairi restored his body. Not long afterward, Roxas reunites with Sora, and Sora reawakens as a complete being, no longer a Heartless. Although he is whole, his time as a Heartless and the magic of his new clothes allows him to periodically assume the Heartless-based Antiform.
As a symptom of the secrets that were hidden within the journal, the digital recording of Sora's Heartless gained new life and, like Data-Sora, evolved into more than a simple facsimile. To that end, the Heartless absorbs both the Bug Blox which spread throughout the Data Worlds and the minds of the slain digital Heartless, increasing its power exponentially.
After clearing the Bug Blox from the data Hollow Bastion, the Journal alerts Data-Sora to a source of the Bugs: Sora's Heartless. Upon defeating Maleficent and Pete, Sora's Heartless's origins are revealed along with its intent to enter the real world to feed on hearts. Data-Sora attacks the digitized Sora's Heartless, causing it to evolve into AntiSora before resuming its Darkside-like form as Data Sora is worn out from the fight. Just as the Heartless is about to win the fight, King Mickey appears and helps Data-Sora slay it by holding the vessel in place so the latter can destroy the Shadow that is his opponent's true form.
The physical Sora's Heartless which appeared in Kingdom Hearts originally took the form of a Shadow, but regained his human form when Kairi recognized him. The digital Heartless within the Journal, which appeared in Kingdom Hearts coded, first appeared as a Darkside with multicolored circuit linings on its shoulders and chest, then as an AntiSora, and finally as a Shadow.
In his Shadow form, Sora can only jump and run. He can no longer activate lift nodes or the pause menu, and unlike other Shadows, he cannot perform a lunge attack. However, if Sora falls too far in the Lift Stop, a lift node will automatically activate to bring him back up to the correct floor.
 Notes and references
 See also