Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6979649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:54:48+00:00 2026-05-27T17:54:48+00:00

I have come across some Base64 conversion functions in .net(FromBase64.string etc). What i want

  • 0

I have come across some Base64 conversion functions in .net(FromBase64.string etc). What i want is, for a sample, i have a base 64 encoded string as

"48YwojCi4yaiow==".

I need to convert this string to the corresponding Hexadecimal text(The sample stands for “Thisistest” in hex text)
The below link is an online converter from base64 to hexadecimal text. If you give the same base64 encoded data in the link , click on convert, the one that is seen below “Hexadecimal text” is what I need.

http://www.hcidata.info/base64.htm

Is there a standard library function in vb.net which does this? Converting a base 64 data to a hexadecimal text?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:54:48+00:00Added an answer on May 27, 2026 at 5:54 pm

    You’ll need to use the Convert.FromBase64String method to first convert the base64-encoded string into an array of bytes.

    You can then take that array of bytes and individually convert them to their equivalent hexadecimal representation using the overload of Byte.ToString that accepts a format specifier. The format specifiers available are documented here, but the you want is either X or x for hexadecimal, depending on whether you want the letters to be capitalized or not.

    You could encapsulate all of this into an extension method for the String class if you wanted to hide it all away for ease of use purposes. For example:

    <System.Runtime.CompilerServices.Extension> _
    Public Shared Function ConvertToHex(str As String) As String
        ' Convert the specified base64-encoded string into an array of bytes.
        Dim bytes As Byte() = Convert.FromBase64String(str)
    
        ' Loop through each of the items in the array and convert
        ' to their equivalent hexadecimal representations
        Dim sb As New StringBuilder()
        For Each b As Byte In bytes
            sb.Append(b.ToString("X2"))
        Next
        Return sb.ToString()
    End Function
    

    Alternatively, you could investigate using the BitConverter.ToString method instead of the loop to convert each of the values in the byte array to their equivalent hexadecimal string representations. This will produce a hyphen-delineated string of hexadecimal pairs.

    I have no idea which method is “better” or more performant. You’ll have to profile the code, or chose whichever you find more readable.

    <System.Runtime.CompilerServices.Extension> _
    Public Shared Function ConvertToHex(str As String) As String
        ' Convert the specified base64-encoded string into an array of bytes.
        Dim bytes As Byte() = Convert.FromBase64String(str)
    
        ' Convert each of the items in the array to a hex string.
        return BitConverter.ToString(bytes)
    End Function
    

    If you don’t want the dashes in the string that the BitConverter.ToString method returns, you’ll need to remove them:

    returnString.Replace("-", String.Empty)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just starting .Net development (C#) and have come across some code that
I want to use AES encryption in my application. I have come across some
I have come across various situations, where I want to store some formatted data
i'm updating some VB6 code to .NET and have come across a small problem.
I have come across some strange behaviour, and I'm assuming a bug in Firefox,
I have come across an annoying problem while writing some PHP4 code. I renamed
I've come across some SQL queries in Oracle that contain '(+)' and I have
I have taken over some code from a previous developer and have come across
I'm moving some code from Microsoft.Practices.EnterpriseLibrary.Validation.Validators to System.ComponentModel.DataAnnotations, and have come across a more
I've been writing PHP web applications for some time, and have come across very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.