Pour about 2–3 inches of oil into a heavy pot or deep fryer and heat to 350°F (175°C).
In a large bowl, whisk together cornmeal, flour, sugar, baking powder, baking soda, and salt.
In a separate bowl, whisk the egg and buttermilk until combined. Stir in chopped onion if using.
Pour the wet mixture into the dry ingredients. Stir gently until just combined.
Use a small cookie scoop or two spoons to drop rounded spoonfuls of batter into the hot oil. Fry in batches, about 2–3 minutes per side, until golden brown.
Transfer hush puppies to a baking sheet lined with paper towels to drain. Serve warm!