In a hidden universe, dolls are anthropomorphized and chosen for a single child, while deformed dolls are dropped into the remote town of Uglyville. Among these dolls is the idealistic Moxy (Kelly Clarkson), who dreams of the 'Big World' and being chosen for a child ("Today's the Day"/"Couldn't Be Better"), despite Uglyville's Mayor Ox (Blake Shelton) assuring her this is a myth. On advice from the village. Lucky Bat (Wang Leehom), Moxy enters the hole from which new Ugly Dolls arrive, hoping to reach the Big World with the help of Lucky Bat and her friends, easy-going Ugly Dog (Pitbull), cynical baker Wage (Wanda Sykes), and strong, soft-spoken Babo (Gabriel Iglesias).
Moxy and her friends follow the tunnel to the Institute of Perfection ("Today's the (Perfect) Day") where dolls go through a number of tests, culminating in 'the Gauntlet', an obstacle course based on a human house, to be with their perfect child. The Institute's superficial doll leader Lou (Nick Jonas) meets the Ugly Dolls ("The Ugly Truth"), but states that they do not meet the standards to participate in the Gauntlet. Faced with Moxy’s positivity, Lou agrees to let them try, hoping to ruin her optimism. The friends meet a perfect doll named Mandy (Janelle Monáe), who is more accepting of the Ugly Dolls and has poor eyesight, but refuses to wear glasses and be labelled 'imperfect.'
The Ugly Dolls' first days of training ("You Make My Dreams") end in disaster. They dress up like the perfect dolls for a better chance at reaching the Big World ("All Dolled Up"). Lou sends the Spy Girls, a trio of ruthless perfect dolls – Tuesday (Bebe Rexha), Kitty (Charli XCX), and Lydia (Lizzo) – to kidnap Ox, and makes him confess that he and Lou were once friends who trained for the Gauntlet, until Ox fell short of its standards and was banished to the doll factory’s recycling bin. After, he boarded it up to pave way for Uglyville, where he kept the Big World a secret from his fellow Ugly Dolls to protect them from the same rejection. Demoralized, Moxy abandons her quest and returns to Uglyville.
Learning the truth, the residents of Uglyville lose their morale, The next day, as Moxy resigns herself to a lifetime of sadness and self-loathing, Mandy visits and convinces her that what Lou said does not matter, only Moxy’s belief that there is a child for her in the Big World ("Unbreakable"). With her confidence renewed, Moxy decides to rejoin the Gauntlet, but she and Mandy are kidnapped by the Spy Girls on orders from Lou to take them to the recycling bin. The rest of the Ugly Dolls soon find out about this and come to their rescue, and they arrive at the Gauntlet, to Lou’s chagrin.
As the Ugly Dolls advance through the challenges, Ugly Dog distracts a robot dog by putting on a disguise and dancing to help the other Ugly Dolls, ("Bon Bon") prompting Lou to try to sabotage Moxy. Nearing the finish line, Lou makes a robot baby cry after kicking it in the face, prompting the perfect dolls, including the Spy Girls, to shun him while an empathetic Moxy comforts the crying baby. Lou crosses the finish line, but Moxy and her friends are dubbed the winners for making a child happy — a doll's true purpose. Lou is revealed to be a 'prototype' by Lydia resulting in the original standards. Angered, Lou — in a last-ditch attempt to keep the Ugly Dolls from leaving — tries to use a giant knitting needle to destroy the portal to the Big World believing if he can't go, then no one can. He is foiled by the Ugly Dolls and thrown into the washing machine by a doll named Nolan.
The Ugly Dolls and the Perfect Dolls fix the portal, make peace, and merge their hometowns to create the town of Imperfection ("The Big Finale"). Moxy finally goes through the portal, where she is put into the arms of her special kid, a little girl named Maizy who is missing a tooth like Moxy, much to her elation.
During the credits ("Broken & Beautiful"), the Ugly Dolls, Mandy, and the Spy Girls are each shown to have found their own special kid with similar characteristics except Lou who is the only doll without a kid, while Lou is demoted and forced to janitorial duty, sentenced and overseen by the robot dog.