HTML - hexa conversion

I want that in my source code, I write something in hexa, but when we are watching the page, what was hexa is text. How can I do ?

10/21/2018 8:52:47 AM

NoxFly ドリアン

12 Answers

New Answer


Just convert text element to &#(hexadecimal code); https://code.sololearn.com/WwA7A95aL3W3/?ref=app


Calviղ Thx. I also want to learn that.


You could use this tool to do conversion https://code.sololearn.com/WfMfIbPM9OXG/?ref=app


To Calviղ s answer I ll add 2 more things. 1. We can use html entities both in decimal and hexadecimal format. so in an html page, a will give 'a' , its decimal and a will also give 'a', its hexadecimal but since you said hex, hence here s slightly modified example from Calviղ s Code return '&#x' + c.codePointAt(0).toString(16) + ";" 2. If you also wish to include emojis in ur text or any other exotic character then charCodeAt() will not work, its always best to use the newer codePointAt() method, unless performance is an issue. https://code.sololearn.com/WH47x19QJ717/?ref=app




You are right for non English contents. As long as the contents is in English text we still use ascii, single byte, except symbols.


yes, but ASCII is now replaced by Unicode, so if I can I try to do not use ascii ^^


thanks guys. I have also learnt something 👍


The converter can be used for Unicode conversion as well, give it again.



Calviղ very nice code


I did same than you Daniil Datsenko, do a special post for this plz, and delete your comment thanks