{"id":1856,"date":"2025-01-10T16:01:12","date_gmt":"2025-01-10T16:01:12","guid":{"rendered":"https:\/\/donhit.com\/en\/?p=1856"},"modified":"2025-02-07T09:26:33","modified_gmt":"2025-02-07T09:26:33","slug":"decimal-to-hexadecimal","status":"publish","type":"post","link":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/","title":{"rendered":"Decimal to Hexadecimal Converter"},"content":{"rendered":"<p><center><div class=\"container123\">\r\n        <h2>Decimal to Hexadecimal Converter<\/h2>\r\n        <div class=\"input-group\">\r\n            <label for=\"decimal\">Enter Decimal Number:<\/label>\r\n            <input type=\"text\" id=\"decimal\" placeholder=\"Enter a decimal number\" autocomplete=\"off\">\r\n            <div class=\"error\" id=\"error\">Please enter a valid decimal number<\/div>\r\n        <\/div>\r\n        <button onclick=\"convertToHex()\">Convert to Hex<\/button>\r\n        <div class=\"result\" id=\"result\">\r\n            Result will appear here\r\n        <\/div>\r\n    <\/div>\r\n\r\n    <script>\r\n        function convertToHex() {\r\n            const decimalInput = document.getElementById('decimal');\r\n            const resultDiv = document.getElementById('result');\r\n            const errorDiv = document.getElementById('error');\r\n            \r\n            \/\/ Reset error state\r\n            errorDiv.style.display = 'none';\r\n            decimalInput.style.borderColor = '#e0e0e0';\r\n\r\n            \/\/ Get input value and remove whitespace\r\n            const decimal = decimalInput.value.trim();\r\n\r\n            \/\/ Validate input\r\n            if (!decimal) {\r\n                showError('Please enter a number');\r\n                return;\r\n            }\r\n\r\n            \/\/ Check if input is a valid decimal number\r\n            if (!\/^-?\\d+$\/.test(decimal)) {\r\n                showError('Please enter a valid decimal number');\r\n                return;\r\n            }\r\n\r\n            try {\r\n                \/\/ Convert to hex\r\n                const num = parseInt(decimal);\r\n                const hex = num.toString(16).toUpperCase();\r\n                resultDiv.textContent = `Hex: 0x${hex}`;\r\n                \r\n                \/\/ Add success animation\r\n                resultDiv.style.backgroundColor = '#e8f5e9';\r\n                setTimeout(() => {\r\n                    resultDiv.style.backgroundColor = '#f5f5f5';\r\n                }, 500);\r\n            } catch (e) {\r\n                showError('Conversion failed. Please try again');\r\n            }\r\n        }\r\n\r\n        function showError(message) {\r\n            const errorDiv = document.getElementById('error');\r\n            const decimalInput = document.getElementById('decimal');\r\n            \r\n            errorDiv.textContent = message;\r\n            errorDiv.style.display = 'block';\r\n            decimalInput.style.borderColor = '#ff4444';\r\n        }\r\n\r\n        \/\/ Add Enter key support\r\n        document.getElementById('decimal').addEventListener('keypress', function(e) {\r\n            if (e.key === 'Enter') {\r\n                convertToHex();\r\n            }\r\n        });\r\n\r\n        \/\/ Clear error on input\r\n        document.getElementById('decimal').addEventListener('input', function() {\r\n            document.getElementById('error').style.display = 'none';\r\n            this.style.borderColor = '#e0e0e0';\r\n        });\r\n    <\/script><\/center>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1856","post","type-post","status-publish","format-standard","hentry","category-convert"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Decimal to Hexadecimal Converter - DonHit<\/title>\n<meta name=\"description\" content=\"The hexadecimal number system, commonly referred to as base 16, is a numeral system that uses 16 distinct symbols to represent values.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Decimal to Hexadecimal Converter - DonHit\" \/>\n<meta property=\"og:description\" content=\"The hexadecimal number system, commonly referred to as base 16, is a numeral system that uses 16 distinct symbols to represent values.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/\" \/>\n<meta property=\"og:site_name\" content=\"DonHit - World of Tools\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-10T16:01:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-07T09:26:33+00:00\" \/>\n<meta name=\"author\" content=\"DonHit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DonHit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Decimal to Hexadecimal Converter - DonHit","description":"The hexadecimal number system, commonly referred to as base 16, is a numeral system that uses 16 distinct symbols to represent values.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/","og_locale":"en_US","og_type":"article","og_title":"Decimal to Hexadecimal Converter - DonHit","og_description":"The hexadecimal number system, commonly referred to as base 16, is a numeral system that uses 16 distinct symbols to represent values.","og_url":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/","og_site_name":"DonHit - World of Tools","article_published_time":"2025-01-10T16:01:12+00:00","article_modified_time":"2025-02-07T09:26:33+00:00","author":"DonHit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"DonHit","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/#article","isPartOf":{"@id":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/"},"author":{"name":"DonHit","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"headline":"Decimal to Hexadecimal Converter","datePublished":"2025-01-10T16:01:12+00:00","dateModified":"2025-02-07T09:26:33+00:00","mainEntityOfPage":{"@id":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/"},"wordCount":11,"commentCount":0,"publisher":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"articleSection":["Conversion Calculators"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/","url":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/","name":"Decimal to Hexadecimal Converter - DonHit","isPartOf":{"@id":"https:\/\/donhit.com\/en\/#website"},"datePublished":"2025-01-10T16:01:12+00:00","dateModified":"2025-02-07T09:26:33+00:00","description":"The hexadecimal number system, commonly referred to as base 16, is a numeral system that uses 16 distinct symbols to represent values.","breadcrumb":{"@id":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/donhit.com\/en\/convert\/decimal-to-hexadecimal\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Trang ch\u1ee7","item":"https:\/\/donhit.com\/en\/"},{"@type":"ListItem","position":2,"name":"Conversion Calculators","item":"https:\/\/donhit.com\/en\/category\/convert\/"},{"@type":"ListItem","position":3,"name":"Decimal to Hexadecimal Converter"}]},{"@type":"WebSite","@id":"https:\/\/donhit.com\/en\/#website","url":"https:\/\/donhit.com\/en\/","name":"DonHit - World of tools","description":"","publisher":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/donhit.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148","name":"DonHit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/donhit.com\/en\/wp-content\/uploads\/2024\/11\/logo-donhit.webp","contentUrl":"https:\/\/donhit.com\/en\/wp-content\/uploads\/2024\/11\/logo-donhit.webp","width":400,"height":267,"caption":"DonHit"},"logo":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/image\/"},"description":"DonHit is a website designed to provide useful tools for everyone. Its primary goal is to support and empower the community. All the tools available on the site are completely free to use.","sameAs":["https:\/\/donhit.com\/en"],"url":"https:\/\/donhit.com\/en\/author\/admin_don\/"}]}},"_links":{"self":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1856","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/comments?post=1856"}],"version-history":[{"count":3,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1856\/revisions"}],"predecessor-version":[{"id":2192,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1856\/revisions\/2192"}],"wp:attachment":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/media?parent=1856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/categories?post=1856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/tags?post=1856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}