We investigate the Q-ball decay in the gauge-mediated SUSY breaking. Q balls decay mainly into nucleons, and partially into gravitinos, while they are kinematically forbidden to decay into sparticles which would be cosmologically harmful. This is achieved by the Q-ball charge small enough to be unstable for the decay, and large enough to be protected kinematically from unwanted decay channel. We can then have right amounts of the baryon asymmetry and the dark matter of the universe, evading any astrophysical and cosmological observational constraints such as the big bang nucleosynthesis, which has not been treated properly in the literatures.