opinion: Mr. Justice Burton
  delivered the opinion of the Court.
  The question presented is whether trustees, who, in 1944, permanently set aside a charitable contribution from gains realized upon the disposition of capital assets held for more than six months, were entitled, in computing the federal income tax of the trust, to deduct the full amount of the contribution, although only half of those gains were taken into account in computing net income. For the reasons hereafter stated, our answer is in the negative.
  The respondents are trustees of a trust created by the will of John E. Andrus. The will directs that the net income of the trust be divided into 100 parts, 55 to be paid to certain individual beneficiaries and 45 to the Surdna Foundation, Inc., a charitable corporation. Pursuant to those terms the trustees permanently set aside for the Foundation 45% of the trust’s net income for the fiscal year ended April 30, 1944, the period involved in this case.
  In their fiduciary tax return, the trustees reported ordinary net income of $240,567.73, and deducted from it, as a charitable contribution, the $108,255.48 (45% of that net income) which they had set aside for the Surdna Foundation. This was done under § 162 (a) of the Internal Revenue Code. The trustees also reported gains of $60,374.01 on the disposition of capital assets held for more than six months. Of these gains, they took into account only 50%, amounting to $30,187.01, in computing the trust’s taxable income. This was done under § 117 (b). An uncontroverted deduction of $329.60, representing the carry-over of a 1942 loss, reduced this amount to $29,857.41. From this the trustees deducted 45%, representing a proportionate share of the trust’s contribution to the Surdna Foundation. This deduction amounted to $13,435.83, leaving a taxable net income of $16,421.58, on which a tax of $5,480.35 was paid, plus interest.
  In 1947 the trustees filed a claim for a refund of $5,157.41. They based their claim upon a 1946 decision of the Tax Court as to the 1941 taxes of a nearly identical trust. Andrus Trust No. 1 v. Commissioner, 7 T. C. 573. On that basis, the trustees claimed a deduction from the aforesaid $29,857.41, not only of a proportionate share of the contribution which the trust had set aside from capital gains, but of the entire amount of that contribution. This increased that deduction from $13,435.83 (45% of $29,857.41) to $27,168.31 (45% of the total capital gains of $60,374.01), and correspondingly reduced the trust’s taxable net income from $16,421.58 to $2,689.10.
  In July, 1947, the Court of Appeals for the Second Circuit unanimously reversed the Tax Court in the case relating to 1941 taxes. Commissioner v. Central Hanover Bank Co., 163 F. 2d 208, cert. denied, November, 1947, 332 U. S. 830. The Commissioner, however, took no action on the trustees’ claim for a refund relating to 1944 taxes, and, in 1948, the trustees filed this proceeding for its recovery through the Court of Claims. With one judge dissenting, that court decided in their favor. 112 Ct. Cl. 550, 81 F. Supp. 717. To resolve the resulting conflict, we granted certiorari. 336 U. S. 966.
  An illustration based upon the facts in the instant case will bring the statutory problem into clearer focus. A trust realizes gains of $60,000 during the tax year from the sale of capital assets held for more than six months. From these it makes a charitable contribution of 50%. Section 162 (a) of the Code provides that a trust may deduct any part of its “gross income” which it contributes to such a charity as the one selected. Section 117 (b) provides that only 50% of such gains shall be taken into account in computing net income.
  The trustees contend that, for tax purposes, the entire $60,000 is “gross income,” that from this amount the $30,000 charitable contribution may be deducted under § 162 (a), and that the entire remaining $30,000 is to be left out of account by force of § 117 (b), thereby leaving no taxable net income, although $30,000 goes to individual beneficiaries. The Commissioner, however, contends that only the $30,000 of the recognized capital gains that is taken into account by force of § 117 (b) constitutes “gross income,” and that necessarily the other $30,000 that is not to be taken into account for tax purposes is not “gross income.” Beginning, thus, with $30,000 of gross income, the Commissioner allows a deduction from it of that proportionate part of the charitable contribution that is attributable to the half of the recognized capital gains which has been taken into account. That deduction amounts to $15,000, leaving a taxable net income of $15,000.
  The narrow statutory question thus presented is whether the entire recognized capital gains or only that half taken into account under § 117 (b) shall constitute gross income for tax purposes. Stated conversely, the question is whether that half of a taxpayer’s recognized capital gains that is not taken into account for tax purposes shall be left out of account by way of its initial exclusion from gross income, or by way of its subsequent deduction from gross income. On this precise question the Code is silent. No provision of the Code and nothing in the legislative history or administrative practice expressly settles the course to be followed. We, therefore, seek the purposes of the applicable sections of the Code and adopt that construction which best gives effect to those purposes.
  We find that the obvious purpose of § 162 (a) is to encourage the making of charitable contributions out of the gross income of a trust and, to that end, it completely exempts such contributions from income tax, without the limitations imposed upon charitable contributions made by individuals or corporations. This purpose is served by each of the constructions of the Code suggested by the parties. Under either method of computation the beneficiaries of the charitable contribution will receive it in full and free of tax.
  We then find that the effect of § 117 (b) is to tax recognized capital gains like ordinary income, except that the tax on capital gains held for more than six months is to be computed on 50% of the amount on which it would be computed if those gains were ordinary income. The Commissioner’s solution accomplishes precisely that result and thus serves that purpose. In the illustration, if the gains were ordinary income, the amount subject to tax, after the deduction of the charitable contribution, would be $30,000. As it is, the amount subject to tax is $15,000. The trustees’ construction in the instant case would result in taxing the capital gains at substantially less than 50% of the amount at which they would be taxed if they were ordinary income. To the extent that the amount subject to tax goes below that percentage, it fails to give effect to the purpose of § 117 (b). In the more extreme circumstances suggested by the illustration, this construction would entirely eliminate the tax.
  We, therefore, approve that interpretation of § 117 (b) and the definition of statutory gross income adopted by the Commissioner. We treat the words in § 117 (b), which state that only 50% of certain recognized capital gains “shall be taken into account in computing . . . net income,” as applying to the entire computation of the tax, beginning with the statement of the gross income of the trust and concluding with its taxable net income. We treat that percentage of capital gains which expressly is not to be taken into account in computing taxable net income as also excluded from statutory gross income.
  Accordingly, the acceptance by the Commissioner of the original return is approved and the judgment of the Court of Claims is
  Reversed.
  Mr. Justice Black and Mr. Justice Jackson are of the opinion that the judgment of the Court of Claims should be affirmed for the reasons which it gave.
  Mr. Justice Douglas took no part in the consideration or decision of this case.
  Mr. Justice Frankfurter.
  The contrariety of views expressed by the Tax Court, the Court of Appeals for the Second Circuit, the Court of Claims and now by this Court in the task of harmonizing §§ 22 (a), 117 (b) and 162 (a) of the Internal Revenue Code conclusively proves the opaqueness, if not inherent incongruity, of those provisions. Courts must do the best they can with such materials since the power to write or rewrite legislation is not theirs. But the fact that a taxpayer may astutely apply his income so as to reduce the net base on which a tax is to be levied is not in itself ground for rejecting a construction of the Revenue Code which permits the reduced base, even though the particular mode of distributing his income may not have been contemplated in the enactment of the classes of exemptions and deductions within which the taxpayer brings himself. I, too, recoil from a bizarre result and if legislation is ambiguous its construction should avoid such a result. But the rationale of construction ought not to be based on the impact of a single bizarre instance.
  A deduction for trust income applied to charitable purposes should not be disallowed merely because one taxpayer can effect the payment of a lower income tax than another through the mode by which the charitable contribution is made. Thus, where the trust instrument provides that all charitable donations shall be allocated from ordinary income and not from capital gains, the taxpayer may doubtless deduct such charitable contributions in full and may at the same time report any capital gains under the special capital gains provisions of the Code. This would secure the very benefits sought by the taxpayers here. The rule enunciated by the Court may therefore itself rest tax liability on the astuteness shown in drawing the trust instrument allocating income for charitable purposes.
  Since I am not alone in entertaining these doubts and they have not been dispelled, it seems appropriate to express them.
  “SEC. 162. NET INCOME.
  “The net income of the estate or trust shall be computed in the same manner and on the same basis as in the case of an individual, except that—
  “ (a) There shall be allowed as a deduction (in lieu of the deduction for charitable, etc., contributions authorized by section 23 (o)) any part of the gross income, without limitation, which pursuant to the terms of the will or deed creating the trust, is during the taxable year paid or permanently set aside for the purposes and in the manner specified in section 23 (o), or is to be used exclusively for religious, charitable, scientific, literary, or educational purposes, or for the prevention of cruelty to children or animals, or for the establishment, acquisition, maintenance or operation of a public cemetery not operated for profit; . . . .” (Emphasis supplied.) 53 Stat. 66, 26 U. S. C. §162 (a).
  “SEC. 117. CAPITAL GAINS AND LOSSES.
  . . . . .
  “(b) Percentage Taken Into Account. — In the casé of a taxpayer, other than a corporation, only the following percentages of. the gain or loss recognized upon the sale or exchange of a capital asset shall be taken into account in computing net capital gain, net capital loss, and net income:
  “100 per centum if the capital asset has been held for not more than 6 months;
  “50 per centum if the capital asset has been held for more than 6 months.” 53 Stat. 50-51, as amended, 56 Stat. 843, 26 U. S. C. §117 (b).
  The will creating the trust contained no provision as to the kind of income from which the charitable contributions were to be set aside, and it is not disputed that the trustees properly set aside the contributions proportionately from capital gains and all other income. There is nothing to indicate that the trustees, in setting aside the contribution, attempted to allocate them to any particular part or percentage of the capital gains. See Helvering v. Bliss, 293 U. S. 144, 149-150; Grey v. Commissioner, 118 F. 2d 153 (C. A. 7th Cir., affirming 41 B. T. A. 234); Scott v. United States, 111 Ct. Cl. 610, 618-620, 78 F. Supp. 811, 815-816; Newbury v. United States, 102 Ct. Cl. 192, 57 F. Supp. 168; Meissner v. Commissioner, 8 T. C. 780; Estate of Traiser v. Commissioner, 41 B. T. A. 228; Montgomery, Federal Taxes, Estates, Trusts and Gifts 179 (1948-1949); 2 Nossaman, Trust Administration and Taxation 115-116 (1945).
  See note 1, supra.
  See note 2, supra.
  See note 1, supra.
  See note 2, supra.
  United States v. Pleasants, 305 U. S. 357, 363; Old Colony Trust Co. v. Commissioner, 301 U. S. 379, 384; Helvering v. Bliss, 293 U. S. 144, 147.
  When the words “without limitation,” in § 162 (a), are read in connection with § 23 (o), 53 Stat. 12, 14-15, as amended, 53 Stat. 880, and 56 Stat. 826, 26 U. S. C. § 23 (o), their effect is only to make inapplicable the limitation of 15%, under § 23 (o), and any other statutory limitation which otherwise might apply to charitable contributions made out of the gross income of an estate or trust. Grey v. Commissioner, 41 B. T. A. 234, 243, aff’d, 118 F. 2d 153. See also, Old Colony Trust Co. v. Commissioner, 301 U. S. 379, 382-384; Commissioner v. Central Hanover Bank Co., 163 F. 2d 208, 211 (C. A. 2d Cir.); Frank Trust of 1931 v. Commissioner, 145 F. 2d 411, 413 (C. A. 3d Cir.); Scott v. United States, 111 Ct. Cl. 610, 618-620, 78 F. Supp. 811, 815-816; Newbury v. United States, 102 Ct. Cl. 192, 57 F. Supp. 168. For the comparable 5% limitation applicable to charitable contributions made by corporations, see 53 Stat. 15-16, as amended, 56 Stat. 822, 26 U. S. C. § 23 (q).
  See note 2, supra. The alternative computation of the tax on capital gains provided by § 117 (c) (2) of the Code is consistent with this result. 53 Stat. 51, as amended, 56 Stat. 843-844, 26 U. S. C. § 117 (c) (2).
  It is unnecessary to review the intricate arguments presented as to the terminology of the Code. They do not compel the adoption of either interpretation or preclude the conclusion here reached. This is not a case in which the trust or the statute has required or even authorized the trustees to earmark their charitable contributions as coming from any particular items of trust income, or from any particular kind of trust income. The issue does not involve any possible allocation of a charitable deduction to ordinary income rather than to capital gains.
  For the requirement that, under § 162 (a), each contribution in order to be deductible must be made or permanently set aside pursuant to the terms of the will or deed creating the trust, and also must be from a part of the gross income of the trust, see Old Colony Trust Co. v. Commissioner, 301 U. S. 379; Frank Trust of 1931 v. Commissioner, 145 F. 2d 411 (C. A. 3d Cir.); Wellman v. Welch, 99 F. 2d 75 (C. A. 1st Cir.); Estate of Tyler v. Commissioner, 9 B. T. A. 255, 262-263.
  See Commissioner v. Central Hanover Bank Co., 163 F. 2d 208, 210; Frank Trust of 1931 v. Commissioner, supra; Wellman v. Welch, supra; Green v. Commissioner, 7 T. C. 263, 277; Maloy v. Commissioner, 45 B. T. A. 1104, 1107.