Eight- and four-membered analogues of N-butyldeoxynojirimycin (NB-DNJ), a reversible male contraceptive in mice, were prepared and tested. A chiral pool approach was used for the synthesis of the target compounds. Key steps for the synthesis of the eight-membered analogues involve ring-closing metathesis and Sharpless asymmetric dihydroxylation and for the four-membered analogues Sharpless epoxidation, epoxide ring-opening (azide), and Mitsunobu reaction to form the four-membered ring. (3S,4R,5S,6R,7R)-1-Nonylazocane-3,4,5,6,7-pentaol (6) was moderately active against rat-derived ceramide-specific glucosyltransferase, and four of the other eight-membered analogues were weakly active against rat-derived β-glucosidase 2. Among the four-membered analogues, ((2R,3S,4S)-3-hydroxy-1-nonylazetidine-2,4-diyl)dimethanol (25) displayed selective inhibitory activity against mouse-derived ceramide-specific glucosyltransferase and was about half as potent as NB-DNJ against the rat-derived enzyme. ((2S,4S)-3-Hydroxy-1-nonylazetidine-2,4-diyl)dimethanol (27) was found to be a selective inhibitor of β-glucosidase 2, with potency similar to NB-DNJ. Additional glycosidase assays were performed to identify potential other therapeutic applications. The eight-membered iminosugars exhibited specificity for almond-derived β-glucosidase, and the 1-nonylazetidine 25 inhibited α-glucosidase (Saccharomyces cerevisiae) with an IC(50) of 600 nM and β-glucosidase (almond) with an IC(50) of 20 μM. Only N-nonyl derivatives were active, emphasizing the importance of a long lipophilic side chain for inhibitory activity of the analogues studied.