{
  "id": "log",
  "version": "33f1f4044116",
  "status": "published",
  "name": "Logarithm Calculator",
  "question": "What is the logarithm of a number?",
  "summary": "Computes the logarithm of a number in any base, or the number or the base from the other two values.",
  "category": "math",
  "subcategory": "arithmetic",
  "url": "https://www.acalculator.org/math/log-calculator",
  "markdown": "https://www.acalculator.org/math/log-calculator.md",
  "kind": "formulas",
  "method": "y = log_b x = ln x ÷ ln b, so b^y = x.",
  "assumptions": [
    "The base is more than 0 and not 1; the number is more than 0.",
    "An old link with base=e uses Euler’s number e ≈ 2.718281828 as the base.",
    "A whole-number logarithm within float error is shown exactly (log₁₀ 1,000 is 3)."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "b": {
        "title": "Base (b)",
        "description": "The base of the logarithm: 10 for the common log, 2.718281828 (e) for the natural log.",
        "type": "number",
        "exclusiveMinimum": 0
      },
      "value": {
        "title": "Number (x)",
        "description": "The number to take the logarithm of. It must be more than 0.",
        "type": "number",
        "exclusiveMinimum": 0
      },
      "answer": {
        "title": "Logarithm (y)",
        "description": "The power the base is raised to to give the number.",
        "type": "number"
      }
    }
  },
  "solve": {
    "fillAny": 2,
    "variables": [
      "b",
      "value",
      "answer"
    ],
    "inputsOnly": []
  },
  "outputs": {
    "base": {
      "label": "Base (b)",
      "description": "The base of the logarithm: 10 for the common log, 2.718281828 (e) for the natural log.",
      "format": "number"
    },
    "value": {
      "label": "Number (x)",
      "description": "The number to take the logarithm of. It must be more than 0.",
      "format": "number"
    },
    "output": {
      "label": "Logarithm (y)",
      "description": "The power the base is raised to to give the number.",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "b": 10,
      "value": 100
    },
    "outputs": {
      "output": 2
    },
    "text": "The logarithm of 100 in base 10 is 2."
  },
  "examples": [
    {
      "given": {
        "b": 10,
        "value": 100
      },
      "expect": {
        "answer": 2
      },
      "source": "hand calculation in content.mdx: 10² = 100; OpenStax, College Algebra 2e, §6.3 Logarithmic Functions. https://openstax.org/books/college-algebra-2e/pages/6-3-logarithmic-functions"
    },
    {
      "given": {
        "b": 2,
        "value": 8
      },
      "expect": {
        "answer": 3
      },
      "source": "hand calculation in content.mdx: 2³ = 8; OpenStax, College Algebra 2e, §6.3 Logarithmic Functions. https://openstax.org/books/college-algebra-2e/pages/6-3-logarithmic-functions"
    },
    {
      "given": {
        "b": 10,
        "value": 0.001
      },
      "expect": {
        "answer": -3
      },
      "source": "hand calculation in content.mdx: 10⁻³ = 0.001; OpenStax, College Algebra 2e, §6.3 Logarithmic Functions. https://openstax.org/books/college-algebra-2e/pages/6-3-logarithmic-functions"
    },
    {
      "given": {
        "b": 2.718281828459045,
        "value": 10
      },
      "expect": {
        "answer": 2.302585092994046
      },
      "source": "hand calculation in content.mdx: ln 10 = 2.30258509…; Python 3: math.log(10) = 2.302585092994046; OpenStax, College Algebra 2e, §6.3 Logarithmic Functions. https://openstax.org/books/college-algebra-2e/pages/6-3-logarithmic-functions"
    },
    {
      "given": {
        "b": 0.5,
        "value": 8
      },
      "expect": {
        "answer": -3
      },
      "source": "hand calculation in content.mdx: 0.5⁻³ = 2³ = 8; OpenStax, College Algebra 2e, §6.3 Logarithmic Functions. https://openstax.org/books/college-algebra-2e/pages/6-3-logarithmic-functions"
    },
    {
      "given": {
        "value": 8,
        "answer": 3
      },
      "expect": {
        "b": 2
      },
      "source": "hand calculation in content.mdx: b = 8^(1/3) = 2; OpenStax, College Algebra 2e, §6.3 Logarithmic Functions. https://openstax.org/books/college-algebra-2e/pages/6-3-logarithmic-functions"
    },
    {
      "given": {
        "b": 10,
        "answer": 3
      },
      "expect": {
        "value": 1000
      },
      "source": "hand calculation in content.mdx: x = 10³ = 1,000; OpenStax, College Algebra 2e, §6.3 Logarithmic Functions. https://openstax.org/books/college-algebra-2e/pages/6-3-logarithmic-functions"
    }
  ],
  "sources": [
    "OpenStax, College Algebra 2e, §6.3 Logarithmic Functions. https://openstax.org/books/college-algebra-2e/pages/6-3-logarithmic-functions",
    "NIST Digital Library of Mathematical Functions, §4.2 Definitions (logarithm, exponential, powers). https://dlmf.nist.gov/4.2"
  ],
  "related": [],
  "changelog": [
    {
      "date": "2026-09-28",
      "note": "Base 1 and values past double range say why there is no answer."
    },
    {
      "date": "2026-09-29",
      "note": "Worked examples name a published reference for their rule."
    }
  ]
}
