Nanoseconds duration square pulses generated by passively mode-locked fiber lasers have lots of applications in scientific research, mechanical processing and optical communication. We present square pulses generation in an Ybdoped figure-of-eight fiber laser by using nonlinear optical loop mirror (NOLM) mode locking technique. The generation of square pulses in the passively mode-locked fiber laser is based on dissipative soliton resonance (DSR) theory. The length of the Yb-doped fiber (YDF) in the cavity is 1 m. The ytterbium ion absorption of the YDF is 250 dB/ m at 975 nm and it is pumped by a 980 nm laser diode. A ~500 m single mode fiber (SMF 1060-XP) with a dispersion of -3.3 ps/ (nm· km) is used to increase the cavity length and nonlinear effects. The total length of the cavity is about 502 m. The stable output square pulses start to appear when the pump power reaches 147.46 mW, which is the threshold of modelocking. The fundamental repetition rate of the pulse train is 399.88 kHz, corresponding to the cavity length of 502 m. The output pulse duration broadens from 56.4 ns to 218.4 ns with the pump power increasing from the mode-locked threshold to 481.59 mW, while the peak power maintains a constant value. The maximum output energy of a single pulse is 8.48 nJ at the pump power of 481.59 mW. Both of the pulse duration and the output energy increase linearly with the pump power because of the DSR. Future work is needed to increase the stability and width of the square pulse.