The novel opens with a radio broadcast warning that Allied forces liberating the concentration camps at the end of World War II are sending prisoners marked with pink triangles (designating homosexuals) and qualifying black triangles (a category encompassing transgender people) to jail rather than freeing them. Any surviving "inverts," a term for homosexual people, "transvestites, and lilac people," a broader term for queer people, are still not safe.
It is mid-May 1945, two weeks after Germany's surrender. Bertie Durchdenwald, a 47-year-old trans man and former assistant to Dr. Magnus Hirschfeld at the Institut für Sexualwissenschaft (Institute of Sexual Science) in Berlin, lives under the assumed name Goss Baumann on a small farm near Ulm with his lover, Sofie Hönig, who goes by Ina Baumann. They have hidden throughout the war on this farm, which belonged to the grandparents of Bertie's missing best friend, Gert Baumann, adopting the elderly couple's identities. Bertie's only keepsake is a photo album containing pictures of friends, clippings about trans people living undetected in the American Midwest, and his transvestite card, a document issued by the Institut to protect crossdressers from arrest.
Bertie discovers a collapsed figure in the asparagus ferns wearing a camp prisoner's striped uniform. The stranger, Karl Fuchs, is a fellow transvestite who fled Dachau during the Allied liberation after witnessing pink and black triangle prisoners sent to jail. Bertie and Sofie nurse Karl back to health. Their suspicious neighbor, Frau Baer, visits with probing questions; Bertie hides Karl. A compulsory labor order from Lieutenant William Ward of the U.S. Army requires them to report to a nearby camp, where discovery would be certain. Bertie proposes fleeing to America on a ship departing Amsterdam in three weeks and plans to write Gert's American boyfriend, Roy Collins, for help.
The narrative shifts to Berlin in December 1932. A younger Bertie visits the Eldorado, one of Berlin's most famous clubs for transvestites and sexual minorities, for his first night out after chest surgery. He reunites with friends, including Gert, a carpenter's assistant who has obtained American citizenship through Roy. Bertie meets Sofie for the first time; she is a pianist interested in workers' rights. Gert toasts Bertie's surgery, and Sofie plays "Das Lila Lied" (The Lilac Song), the community's anthem, as the room sings together. Bertie leads tours at the Institut, which houses over 20,000 books and 35,000 slides on sexual intermediates, Hirschfeld's umbrella term for queer and trans people. Gert's grandfather Opa visits and warns Bertie never to laugh in the face of villainy.
Back in 1945, Bertie teaches Karl to pass as a man in public. Karl resists, arguing that Bertie, whose body passes more easily, will always be safer. Ward searches the house; Karl escapes through a window. In the 1932 timeline, Bertie spots Sofie among retreating Communists after a street clash with Nazis. At his apartment, she confides that at fifteen she turned away from her eight-year-old nephew while swimming, and he drowned. That night they share his bed for the first time, a habit that persists for thirteen years.
Americans march townspeople to Oberer Kuhberg for a forced viewing of Holocaust artifacts. At the final table, Bertie recognizes a flat-cap as Gert's. He drops it and vomits. Back home, Karl replies to Bertie's desperate demand: "You already know that." That evening Karl tells his full story. Seized at sixteen during the Night of the Long Knives in 1934, a purge targeting political and sexual threats, he was sent to Dachau and made a pipel, a sexual servant for SS officers who kept him alive in exchange for repeated assault. As he aged, he was transferred through camp brothels, each a step closer to execution. When the Allies arrived, he ran, expecting to be shot, and wandered two weeks before collapsing on Bertie's farm. He concludes: "I don't tell you all this to shock you. I tell you because I need someone to know."
That night, Sofie teaches Karl "Das Lila Lied" on the piano, and all three sing together. Before dawn, Bertie steals Gert's cap from the camp display. The Berlin timeline reaches New Year's Eve 1932, where Bertie meets Roy for the first time at the Institut's celebration. During
bleigießen, a fortune-telling game with molten lead, Gert's casting comes out shaped like a cross, an omen of death. The narrator notes this will be the last time these people ever make such noise.
In 1945, the three forge passports modeled on a photograph of Gert's American documents. Ward returns with parish records proving the real Baumanns were born in the 1860s, but Karl, in Gert's suit and speaking confident English, deflects him with an elaborate story about fleeing anti-Jewish persecution.
Radio-broadcast interludes trace the collapse of queer rights after Hitler becomes chancellor. At the emptying Institut, Bertie processes an application for a young Karl Fuchs, the same person he will find on his farm twelve years later. On May 6, 1933, a Nazi student mob storms the Institut and loots its archives. Bertie escapes and realizes the records he helped compile gave the Nazis tools to hunt his community. On June 30, 1934, Gert warns them of a pogrom, gives them his grandparents' address, and returns home to leave a fake suicide note. Bertie and Sofie flee through the night, bluffing past a roadblock when Sofie fakes a miscarriage. They reach the farm before dawn. Gert never comes.
On the night before departure, Bertie burns his album, his transvestite card, and the last photograph of himself and Gert. Karl finds him, and Bertie confesses: Karl was the young applicant whose file he left on his desk the night the Institut was destroyed, a file that likely led to Karl's capture. Karl reveals he recognized Bertie all along: "Then we're all that's left of our history."
Ward returns with officers, calling Bertie by his real surname, having matched his face to an Institut employment photo. Bertie hurls Oma and Opa's ashes into the officers' faces and runs. Karl scoops what ashes he can into the urn, and he and Sofie flee by car. Bertie reaches the home of Frau Baer, who reveals she is Jewish and has hidden her own identity throughout the war. She conceals Bertie from Ward and gives him her late husband's gold watch for passage.
Bertie walks barefoot to Stuttgart, where he finds Sofie and Karl at the ferry. When Ward boards, a German man whom Bertie suspects is a Nazi, mistaking him for a fellow fugitive from Allied justice, rallies passengers to hide the three under piled coats. On the steamer from Amsterdam, the suspected Nazi startles Karl on deck; Karl goes over the railing, and Sofie dives in after him, redeeming the guilt she has carried since her nephew's drowning.
In New York, immigration agents flag their handmade passports. Karl places Oma and Opa's urn atop a piano, plays "Das Lila Lied" with the passion Sofie taught him, and Bertie and Sofie sing along. The official confiscates the forgeries and issues genuine American passports: Burt, Sophie, and Carl Bauman, the surname kept at Karl's request in honor of Oma and Opa.
Outside, Roy Collins is waiting. When he sees Karl in Gert's clothes and cap, he believes for one moment Gert is alive; the realization breaks over his face. Roy confirms the United States is recruiting Nazis for intelligence work; Bertie realizes the Allies permitted their ship because it carried such recruits. Karl presents Bertie with asparagus berries saved from the farm, wrapped in Gert's handkerchief: seeds that can regrow the family's bushes for generations.
Bertie looks at his new passport, which reads "Male," and reflects that he has the document he always wanted but will never again be Berthold Durchdenwald. When he asks whether things are better in America, Roy does not answer. Sofie says: "Live." Karl offers the novel's final thought: "History isn't artifacts or pictures or things. History is the people who made them. The history is us. And we'll keep passing it on."