
<PAGE>
                                                                    EXHIBIT 5.01
 
                                August 14, 1998
 
IDT Corporation
190 Main Street
Hackensack, NJ 07601
 
              RE: IDT CORPORATION FORM S-3 REGISTRATION STATEMENT
 
Gentlemen:
 
    I am the Secretary and General Counsel of IDT Corporation (the "Company"),
and as such I have been asked to render the following opinion with respect to
the 537,032 shares of the Company's Common Stock, par value $.01 per share (the
"Shares"), being registered with the Securities and Exchange Commission under
the Securities Act of 1933, as amended. All of the Shares being so registered
will be offered and sold from time to time by the selling stockholders
identified in the Company's Registration Statement on Form S-3. I have examined
the proceedings relating to the issuance of the Shares.
 
    It is my opinion that all of the Shares, upon the sale thereof in the manner
referred to in the Registration Statement, will be legally issued Shares and
will be fully paid and non-assessable.
 
    I consent to the use of this Opinion as an exhibit to the Registration
Statement, and I further consent to the use of my name under the caption "Legal
Matters" in the Prospectus which is part thereof.
 
                                          Very truly yours,
                                          /s/ Joyce J. Mason
                                          --------------------------------------
                                          Joyce J. Mason
                                          General Counsel and Secretary
