How To Spell Out Phone Numbers?

Hi all,

I've been looking for a macro that will take a phone number and convert it to a phonetically spelled out format. So for example, 822-555-1010 --> eight-two-two, five-five-five, one-oh-one-oh.

One thing that makes things tricky is that, not only does each dash need to be replaced by a comma+space, but any zeroes need to be replaced with an "oh".

This post (How To Spell Out Numbers) seems to point in the right direction, but I have no idea how I might tweak it to do the specific thing I need.

Thanks very much for your help!

Once you have defined your local (character -> syllable) mappings as a JSON formatted dictionary, you have various options.

One of them would be to use a script:

Grouped syllabic transcription of telephone number.kmmacros (5.1 KB)

Expand disclosure triangle to view JS source
(() => {
    "use strict";

    // Syllabic transcription of phone number.

    // RobTrew @2022
    // Ver 0.01

    // main :: IO ()
    const main = () => {
            kme = Application("Keyboard Maestro Engine"),
            kmVar = kme.getvariable,
            digitName = JSON.parse(

        return groupOn(isDigit)([
            g => isDigit(g[0]) ? (
                    c => digitName[c] || (
                        `Unrecognized: ${c}`
            ) : [", "]

    // --------------------- GENERIC ---------------------

    // groupOn :: (a -> b) -> [a] -> [[a]]
    const groupOn = f =>
    // A list of lists, each containing only elements
    // which return equal values for f,
    // such that the concatenation of these lists is xs.
        xs => 0 < xs.length ? (() => {
            const [h, ...t] = xs;
            const [groups, g] = t.reduce(
                ([gs, a], x) => f(x) === f(a[0]) ? (
                    [gs, [...a, x]]
                ) : [[, a], [x]],
                [[], [h]]

            return [...groups, g];
        })() : [];

    // isDigit :: Char -> Bool
    const isDigit = c => {
        const n = c.codePointAt(0);

        return 48 <= n && 57 >= n;

    // MAIN ---
    return main();

And another option would be a %JSONValue% token within a KM For Each block.

Grouped syllabic transcription of telephone number ALT.kmmacros (7.0 KB)


Just to add another option, this particular task can also be done using a series of standard Keyboard Maestro search and replace Actions:

Grouped syllabic transcription of telephone number KM Native.kmmacros (8.8 KB)


Does it? On my system, at least, a dash is a pause:

822-555-1010 -> "eight two two <pause> five five five <pause> one zero one zero".

...and the only character mapping required would be 0 to oh (though personally I'd prefer to hear "zero".

If you do replace 0 with oh you'll find that the speech "runs through" the characters -- "oneoh oneoh" -- but something like this helps a bit:

Speak Some Text.kmmacros (2.0 KB)


...and if you do want to replace - with , you could use a similar search and replace action.

Thanks everyone! The solutions by ComplexPoints and Zabobon are working great! I tweaked them a little (added the user prompt action from the Cardinals macro so I could input any phone number) and so far it's doing everything I wanted.

1 Like

Would love to see your completed macro so all can learn from it! Thanks!

1 Like

Would love to see your completed macro so all can learn from it! Thanks!

Absolutely! I only made a minor change so the macros would open up a window and let me paste in phone numbers.

Phone 2 Words.kmmacros (5.9 KB)
Phone 2 Words (Alt).kmmacros (9.3 KB)

I just added the action below from the Cardinals macro at the beginning, and tweaked a bit so I could use any phone number.

Screenshot 2022-11-23 at 12.32.44 PM

So far, I've been able to use both of these without issues.

Thanks again to ComplexPoint and Zabobon for helping out a newbie. As part of my job I have to transcribe phone numbers dozens of times a day, so these macros are saving me a TON of time (and repetitive typing)!