/dev/zero and /dev/null are two pseudo files which are useful for creating empty files. Many people consider there is no difference or puzzled with what could be the difference between two files. There is considerable difference when writing data using these hardware files.
/dev/zero: This file is used to create a file with no data but with required size(A file with all zero’s). In other words this will create a data file with all zeros in the file which will give the size to a file. If you see the strace command on /dev/zero, it’s continuous zeros which it will write to a file. So we conclude that /dev/zero is a file use full for creating a file with some required size without any meaning to the data.
/dev/null: This is one more Pseudo file which is useful in many places like redirecting unwanted output/error etc to this file. This file acts as a black hole(Which eat up everything and do not show any output). So whenever you feed some data to this file, you can not retrieve the data which is fed to it. This file even useful for creating files with zero size.