Context. The measure of the water deuterium fractionation is a relevant tool for understanding mechanisms of water formation and evolution from the prestellar phase to the formation of planets and comets. Aims. The aim of this paper is to study deuterated water in the solar-type protostars NGC 1333 IRAS 4A and IRAS 4B, to compare their HDO abundance distributions with other star-forming regions, and to constrain their HDO/H 2 O abundance ratios. Methods. Using the Herschel/HIFI instrument as well as ground-based telescopes, we observed several HDO lines covering a large excitation range (E up /k = 22-168 K) towards these protostars and an outflow position. Non-local thermal equilibrium radiative transfer codes were then used to determine the HDO abundance profiles in these sources. Results. The HDO fundamental line profiles show a very broad component, tracing the molecular outflows, in addition to a narrower emission component and a narrow absorbing component. In the protostellar envelope of NGC 1333 IRAS 4A, the HDO inner (T ≥ 100 K) and outer (T < 100 K) abundances with respect to H 2 are estimated with a 3σ uncertainty at 7.5 +3.5 −3.0 × 10 −9 and 1.2 +0.4 −0.4 × 10 −11 , respectively, whereas in NGC 1333 IRAS 4B they are 1 +1.8 −0.9 × 10 −8 and 1.2 +0.6 −0.4 × 10 −10 , respectively. Similarly to the low-mass protostar IRAS 16293-2422, an absorbing outer layer with an enhanced abundance of deuterated water is required to reproduce the absorbing components seen in the fundamental lines at 465 and 894 GHz in both sources. This water-rich layer is probably extended enough to encompass the two sources, as well as parts of the outflows. In the outflows emanating from NGC 1333 IRAS 4A, the HDO column density is estimated at about (2-4) × 10 13 cm −2 , leading to an abundance of about (0.7-1.9) × 10 −9 . An HDO/H 2 O ratio between 7 × 10 −4 and 9 × 10 −2 is also derived in the outflows. In the warm inner regions of these two sources, we estimate the HDO/H 2 O ratios at about 1 × 10 −4 -4 × 10 −3 . This ratio seems higher (a few %) in the cold envelope of IRAS 4A, whose possible origin is discussed in relation to formation processes of HDO and H 2 O. Conclusions. In low-mass protostars, the HDO outer abundances range in a small interval, between ∼10 −11 and a few 10 −10 . No clear trends are found between the HDO abundance and various source parameters (L bol , L smm , L smm /L bol , T bol , L 0.6 bol /M env ). A tentative correlation is observed, however, between the ratio of the inner and outer abundances with the submillimeter luminosity.