The e-file system is a trivial exercise compared to calculating the tax return in the first place. An e-file is simply a series of records that replicate the numbers on a properly filled out paper return*. The exact required format of each record is well documented in Pub 1346. Figuring out the numbers to put on that paper return in the first place is the hard part.