The ASCII Symbol for Degree is used to show temperature or angles. It looks like a small circle: °
. This symbol is helpful in many programming tasks. For example, when writing 25°C or 90° angle, the symbol is needed. In this article, you will learn how to use the ASCII Symbol for Degree in different programming languages. Each method is simple and easy to follow.
What Is the ASCII Symbol for Degree?
The degree symbol is not in the basic ASCII table (0 to 127). It is part of the extended ASCII and Unicode. Its Unicode value is U+00B0
. Its ASCII code is 176 in extended ASCII. You can also use it with Unicode escapes or special characters.
1. Use in Python
Python supports Unicode, so using the degree symbol is easy.
Method 1: Use Unicode Escape
pythonCopyEditprint("The temperature is 30\u00B0C")
This prints: The temperature is 30°C
\u00B0
is the Unicode for the degree symbol.
Method 2: Use the Symbol Directly
You can also copy and paste the degree symbol:
pythonCopyEditprint("Angle: 90°")
This works well in most editors.
2. Use in JavaScript
JavaScript also supports Unicode and HTML entities.
Method 1: Use Unicode Escape
javascriptCopyEditconsole.log("Heat level: 100\u00B0C");
This will show: Heat level: 100°C
Method 2: Use HTML Entity in Web Pages
javascriptCopyEditdocument.write("Boiling point is 100°C");
This shows 100°C in the browser.
3. Use in C or C++
In C and C++, you can use the degree symbol with char(176)
or Unicode.
Method 1: Use Extended ASCII
cCopyEdit#include <stdio.h>
int main() {
printf("Temperature: 25%cC", 176);
return 0;
}
%c
prints the character with ASCII code 176.
This shows: Temperature: 25°C
Note:
Make sure your console supports extended ASCII.
Some compilers may need Unicode setup.
4. Use in Java
Java supports Unicode and character codes.
Method 1: Use Unicode Escape
javaCopyEditpublic class Main {
public static void main(String[] args) {
System.out.println("Angle: 45\u00B0");
}
}
This prints: Angle: 45°
Unicode escape \u00B0
works well in Java strings.
5. Use in HTML and CSS
The ASCII Symbol for Degree is often used in websites.
HTML Entity
htmlCopyEdit<p>Today’s temperature: 28°C</p>
This shows: Today’s temperature: 28°C
You can also use °
.
CSS Content
cssCopyEdit.degree::after {
content: "\00B0";
}
This adds the degree symbol after elements with the class degree
.
6. Use in SQL
In SQL, the symbol can be inserted as a string.
Example in MySQL:
sqlCopyEditSELECT 'Room temp: 22°' AS Temperature;
You can paste the symbol directly into the query.
7. Use in Bash or Shell Scripts
In shell scripts, Unicode symbols work in echo statements.
bashCopyEditecho "Freezing point is 0°C"
You can also use the symbol like this:
bashCopyEditecho -e "Heat level: 100\u00B0C"
Note: Output depends on the terminal.
8. Use in Excel VBA
In Excel macros, the degree symbol can be used with Chr(176)
.
vbaCopyEditSub ShowDegree()
MsgBox "Boiling point is 100" & Chr(176) & "C"
End Sub
This shows a popup with 100°C.
9. Use in PHP
PHP also supports HTML entities and Unicode.
Use HTML Entity
phpCopyEditecho "Temp: 40°C";
Use Unicode Escape
phpCopyEditecho "Angle: 90\u{00B0}";
Both print the degree symbol.
10. Tips for Using the Degree Symbol
- Always test output in your console or browser.
- Make sure your file encoding is UTF-8.
- Use Unicode or HTML entities for best compatibility.
- Do not confuse the symbol with the letter “o”.
11. Copy and Paste Option
If you don’t want to use code, just copy this: °
Paste it into your strings or variables.
It works in most modern editors and languages.
12. Summary
The ASCII Symbol for Degree is used in many programs and platforms.
Here are some ways to use it:
Language | Code Example |
---|---|
Python | \u00B0 or ° |
JavaScript | \u00B0 or ° |
C/C++ | printf("%c", 176) |
Java | "45\u00B0" |
HTML | ° or ° |
SQL | '22°' |
Shell Script | echo -e "100\u00B0C" |
PHP | "\u{00B0}" or "°" |
All methods are easy and quick.
Using the correct symbol makes your output clear and professional.
Final Words
The ASCII Symbol for Degree is important in many coding tasks. You can show temperatures, angles, and more. Use Unicode or ASCII code to print the symbol. Now you know how to use it in different languages. Try these methods and use the symbol with confidence!

Latest Businesses helps you list your business on every possible business directory in the best possible way to increase your business is seen and recognized. This will increase the reach of your business profile in searches across different search engines.