The formula for the compound formed by nitrogen and fluorine is NF3. This compound is known as nitrogen trifluoride and is a colourless, toxic, and corrosive gas. It is used in the production of semiconductors and as an etching agent in the electronics industry.