We have successfully developed and tested a compact shielded superconducting (SSC) magnet with a FeCoV magnetic shield. This was developed for the PrNi$_5$ based nuclear demagnetization refrigerator which can keep temperatures below 1 mK continuously (CNDR) [Toda $it{et~al}$., J. Phys.: Conf. Ser. $bf{969}$, 012093 (2018)]. The clear bore diameter, outer diameter, and total length of the SSC magnet are 22, 42 and 169 mm, respectively, and it produces the maximum field of 1.38 T at an electric current of 6 A. In order to realize both the compactness and the high shielding performance, we carefully chose material and optimized design of the magnetic shield by numerical simulations of the field distribution based on measured magnetization curves of several candidate materials with high permeability. We also measured a heat generated by sweeping the SSC magnet in vacuum to be 230 mJ per field cycle. This value agrees very well with an estimation from the measured magnetic hysteresis of the superconducting wire used to wind the magnet.