
Basic calculator
Add, subtract, multiply or divide two numbers.
Your inputs stay in your browser.
Method and assumptions
Method version 1.0.0 · Updated
Simple operation
Formula: a + b ; a − b ; a × b ; a ÷ b
Enter two numbers and choose the operation. Negative and decimal numbers are accepted. Division by zero is rejected. No expressions with parentheses or operator precedence. Example: 12.5 × 3 = 37.5.
- left
- First number
- operation
- Operation
- right
- Second number
Two finite numbers, one operation at a time. Numeric result displayed with at most 12 significant digits. Overflow and nonzero underflow are reported.
Calculate with code
These short examples use the same inputs and core calculation as this tool. Adapt validation and formatting to your application.
JavaScript
const result = 12 + 5; // replace + with -, *, or /
console.log(result); // 17TypeScript
const result: number = 12 + 5;
console.log(result); // 17Python
result = 12 + 5 # replace + with -, *, or /
print(result) # 17Java
double result = 12 + 5;
System.out.println(result); // 17C#
double result = 12 + 5;
Console.WriteLine(result); // 17