Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Cal — Inline CalculatorNew to Visual Studio Code? Get it now.
Cal — Inline Calculator

Cal — Inline Calculator

studiolabs

| (0) | Free
Inline Calculator
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Cal — Inline Calculator

Cal Extension Logo

Cal is a lightweight, safe inline calculator designed to act as a scratchpad directly inside your code. It provides a simple way to perform math calculations within your files without leaving your editor.

Unlike conventional calculators that blindly evaluate math across your document, Cal is explicitly triggered only when you wrap your expressions in cal(...). It safely ignores your everyday code operations like int x = 10 + 3;.

Features

  • Smart Replacement: Typing cal(10 + 3) and triggering the command replaces it instantly with 10 + 3 = 13.
  • Multiple Ways to Trigger:
    • Using the handy Shift+Enter keyboard shortcut.
    • Clicking the quick-access ⚡ (Zap/Lightning) icon in the top-right corner of your editor tab.
    • Via the editor context menu.
    • Or using the Command Palette (Cal: Calculate).
  • Comprehensive Math Capabilities:
    • Addition +, Subtraction -, Multiplication *, Division /, Modulo %, Power **.
    • Bitwise operations: AND &, OR |, XOR ^, Left Shift <<, Right Shift >>, NOT ~.
    • Nested brackets ( ).
    • Decimal and negative numbers.
    • Base systems input: binary (0b...), hex (0x...), and octal (0o...).
    • Base systems output conversion: Append in hex, in bin, or in oct to the end of your expression to convert the output result format.
  • Safe Parsing: Uses a custom recursive descent parser, making it fully immune to arbitrary code execution (no eval() under the hood).
  • Multi-cursor/Selection Support: Need to calculate 10 items at once? Just highlight them and run the command.

Usage

  1. Open any text or code file.
  2. Type an expression wrapped in cal(), for example:
    cal((100 + 50) / 3)
    cal(2 ** 10)
    cal(0xFF + 0x10)
    cal(0b1100 | 0b0011)
    cal(15 in hex)
    cal(0xFF + 0x10 in bin)
    
  3. With your cursor over the calculation (or highlighting the calculations), hit Shift+Enter or click the execute icon in the top right menu of the editor.
  4. The wrapper is removed and your calculation is evaluated right in place!
    (100 + 50) / 3 = 50
    2 ** 10 = 1024
    0xFF + 0x10 = 271
    0b1100 | 0b0011 = 15
    15 in hex = 0xF
    0xFF + 0x10 in bin = 0b100001111
    

Extension Settings

There are currently no configurable settings, but it's designed to just work right out of the box!

Known Issues

  • None yet.

Release Notes

0.0.1

Initial release of Cal — Inline Calculator. Includes math parsing, multi-base number evaluation, keyboard shortcuts (Shift+Enter), and editor-title menu icon integration.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft