
<PAGE>
                                                                    Exhibit 5.01
 
                    [LETTERHEAD OF MORRISON & FOERSTER LLP]
 
                                                  January 28, 1998
 
IDT Corporation
190 Main Street
Hackensack, New Jersey 07601
Re: Registration Statement on Form S-3 (File No. 333-43501)
Dear Ladies and Gentlemen:
 
    At your request, we have examined the Registration Statement on Form S-3
filed by IDT Corporation, a Delaware corporation (the "Company"), with the
Securities and Exchange Commission on December 30, 1997 (Registration No.
333-43501), Amendment No. 1 thereto filed on January 6, 1998, and Amendment No.
2 thereto filed on January 28, 1998 (the "Registration Statement"), relating to
the registration under the Securities Act of 1933, as amended, of 4,815,000
shares of the Company's common stock, par value $.01 per share (the "Stock"),
including up to 4,615,000 authorized but unissued shares being offered by the
Company and up to 200,000 shares being offered by certain selling stockholders
(the "Selling Stockholders"). The Stock is to be sold to the underwriters named
in the Registration Statement for resale to the public.
 
    As counsel to the Company, we have examined the proceedings taken and
proposed to be taken by the Company in connection with the proposed issuance and
sale by the Company of the Stock. We have also examined the proceedings taken
and proposed to be taken by the Company in connection with the sale of Stock by
the Selling Stockholders.
 
    We are of the opinion that (a) the shares of Stock to be offered and sold by
the Company have been duly authorized and, when issued and sold by the Company
in the manner described in the Registration Statement and in accordance with the
resolutions proposed to be adopted by the Board of Directors of the Company,
will be validly issued, fully paid and nonassessable, (b) the outstanding shares
of Stock to be offered and sold by certain Selling Stockholders have been duly
authorized and are validly issued, fully paid and nonassessable, and (c) the
shares issuable upon the exercise of stock options by certain Selling
Stockholders, when issued upon payment of the applicable exercise prices and in
accordance with the applicable stock option agreements, will be validly issued,
fully paid and nonassessable.
 
    We consent to the use of this opinion as an exhibit to the Registration
Statement and further consent to the reference to our firm set forth under the
caption "Legal Matters" in the Registration Statement, the prospectus
constituting a part thereof and any amendments thereto.
 
                                          Very truly yours,
                                          /s/ Morrison & Foerster LLP
                                          Morrison & Foerster LLP
