DEV Community

Cover image for A Beginner's Guide to Unicode Math Symbols
Mia He
Mia He

Posted on

A Beginner's Guide to Unicode Math Symbols

Have you ever tried to write a math problem in a message and ended up with "x^2 + y^2 = z^2"? I mean, it does work. People get it. But it doesn't look very good, does it?

I saw this problem for the first time when I was helping my younger cousin with her homework on WeChat. She would send me pictures of her math problems, and I would try to type the answers back to her. But it wasn't easy to type "√" or "≠." I didn't even know how to find them on my keyboard.

That's when I got lost in a rabbit hole of information about Unicode math symbols.

What do these symbols mean?

So, this is what I mean. These are not special pictures when you see a square root sign like √ or a "not equal" sign like ≠. These are real text characters. Your computer sees them the same way it sees the letter "a" or the number "5."

Unicode is like a huge list of characters. It has letters from almost every language on the planet. It also has math symbols, arrows, emojis, and all sorts of other strange things. Every character has its own code number.

The code for the plus-minus sign (±) is U+00B1. The U+221E symbol for infinity is ∞.

You don't really need to remember these codes. I'm just bringing them up so you know how it works behind the scenes.

What are the reasons people use Unicode math symbols?

I was curious about this for a while.

The most common reason is simple: it looks better. Take a look at these two:

  • "a != b" - "a ≠ b"

The second one is cleaner. Looks more professional.

I see people use these symbols in their social media bios, chat messages, and even the subject lines of their emails. They are used by teachers in papers. Programmers put them in comments in their code.

Some platforms don't support special formatting, which is another reason. In a plain text field, you can't use subscript or bold. You can, however, copy and paste a Unicode symbol, and it will show up correctly.

The math symbols that people look for the most

Here are a few that I use a lot.

Basic tasks:

  • × (multiplication, since "x" looks strange)
  • ÷ (to divide)
  • ± (plus or minus)

Comparison:

  • ≠ (not equal) - ≤ (less than or equal)
  • ≥ (more than or equal to)
  • ≈ (about equal)

Other helpful ones:

  • √ (the square root)
  • ∞ (infinity)
  • π (pi) - ∑ (sum) - ∫ (integral)

It's not too hard to type some of these. I can get ≠ on my Mac by pressing Option + =. But to be honest, I always forget these shortcuts.

How do you really type them?

This is where things start to get messy.

You can use Alt codes on Windows. You press Alt and then type a number on the numpad. But who remembers that Alt+247 is the code for ≈? Not me.

You can use keyboard shortcuts on a Mac. Some are easy to understand. A lot of them aren't.

Copying and pasting is the method I use the most. I look for the symbol and copy it. After that, I put it where I need it.

You can find and copy Unicode symbols on some websites. When I need to find something specific, I sometimes use a Unicode symbol and font tool. You just click on the symbol, and it copies to your clipboard.

A little technical note

At first, I was confused because some symbols look the same but are actually different characters.

For instance, you can type the regular minus sign with your keyboard. The mathematical minus sign (−) is another Unicode character. They look very similar. But in a technical sense, they are different.

The letter "x" and the multiplication sign "×" are the same.

Most of the time, this difference doesn't matter to anyone. But it might matter if you're doing something technical, like writing LaTeX or coding.

What about subscripts and superscripts?

Oh, this is a fun one.

There are actually superscript numbers in Unicode. You can write "x²" instead of "x^2." The ² is a real character, not text that has been formatted.

You can use these superscripts: ⁰ ¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹

There are also some letters that are superscript, like ˣ and ˣ. But not all of the letters.

There are also subscripts: ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉

You could write H₂O for water. Looks good.

The problem is that these don't cover everything. For example, standard Unicode doesn't have a superscript "a." So, writing xᵃ isn't easy. There are ways to get around this by using different Unicode blocks, but that's going too far.

When things don't show up right

This happens from time to time.

You put a nice math symbol in a document. But on someone else's computer, it looks like a small box or a question mark. This means that their system doesn't have a font that can handle that character.

Most of the time, common symbols like ± or √ work. More obscure math symbols might not work.

When I'm not sure who I'm talking to, I've learned to stick with the basic symbols. The fancy things are nice, but only if people can see them.

My own opinion

As I said before, I got into this because I had a very real problem. I just wanted to type math symbols into chat messages.

I use them all the time now. In notes. In messages. When I'm feeling fancy, I post on social media.

It's one of those little things that makes text look better. Once you know where to find the symbols, copying and pasting them takes only two seconds.

I still don't remember how to use the keyboard shortcuts. Someday, maybe.

Top comments (0)