In this study, a method of simultaneous activation and nitrogen doping during biomass fast pyrolysis for co-production of porous N-doped biochar and H2-rich gas production was proposed. The effect of temperature on chemical interaction mechanism of KOH and NH3 was investigated at 500-800°C. Results showed that KOH and NH3 had a synergistic effect on pore development and nitrogen doping, and the specific surface area and nitrogen content reached maximum values of 2008.37 m2/g and 5.05 wt.%, respectively. It may be due to that NH3 entered pores generating by KOH activation for further activation, and at the same time, excessive NH3 could convert new O-containing groups to N-containing groups for more effective nitrogen doping. What's more, the H2 concentration and yield were up to 56.67 vol.% and 517.95 mL/g, respectively. It indicates that the synchronization method of fast pyrolysis-activation-nitrogen doping is a promising approach, which is of great significance for the high-value utilization of biomass.