Home

Spotlight Trick: Doing Quick Math

Synopsis:

Learn how to perform simple math calculations using Spotlight in this quick tip. No need to reach for a desktop calculator anymore.

Let's Begin:

A calculator is an indispensable tool and at most jobs involving a computer it’s not uncommon to need to perform simply arithmetic computations several times a day. You could grab the handheld calculator next to your desk, but why take your hands off the keyboard to do simple math when you don’t have to.  Few people realize that Spotlight in Mac OS X will do math for you and it’s a really useful feature that isn’t advertised nearly enough.  All you have to do is to type the equation you want it to evaluate into the Spotlight search box. Use the keyboard shortcut to activate Spotlight to save having to reach for the mouse.  The shortcut is cmd-space bar (hold down the command key and then press the space bar).  Once the Spotlight search field appears, just start typing the math expression you want to calculate:

shows calculating 2+2 with the spotlight interface

As you type, Spotlight will compute the answer as you go along and display the answer in the first line of results.  Once you’ve got your answer, then just press the esc key twice to dismiss the Spotlight box. (Pressing esc once clears the search field and pressing it a second time closes Spotlight.)

The calculator Spotlight provides offers the basic four arithmetic functions of addition, subtraction, multiplication and division using the symbols +, -, *, and / respectively.  It also offers exponentiation (**) and the modulo operator (%).  The Spotlight calculator implements standard precedence rules where exponentiation has the highest precedence, followed the multiplication and division operators, followed by addition and subtraction. As usual, operators of equal precedence are evaluated from left to right.  You can add parentheses to override the standard precedence rules like this:

shows the evaluation of (100+50)*2 using the spotlight calculator

If you want to go to the full Calculator app at this point, then just hit return and the app will open (since Spotlight has automatically highlighted it as shown above).

This handy tip can save you a lot of needless mousing or reaching for an external calculator in the course of a day. And I find that using Spotlight is a lot better than using the calculator in Dashboard since it’s a much quicker technique.  Switching to Dashboard usually requires a couple of seconds and then you need to grab the mouse to activate the calculator widget.  Using the Spotlight technique presented here saves all that and allows you to keep your hands on the keyboard.

Category: Apple Mac OS X