Click here to Skip to main content
15,897,891 members
Everything / Base64

Base64

Base64

Great Reads

by John Jiyang Hou
A Base62 encoding algorithm with a special prefixed code for utilizing Base64 schema in Java
by Jeff Dabulis
In this tip, you will learn how to transfer that sample code from your home computer to your locked-down computer.
by WebBiscuit
Base64 Encoder and Boost
by Morgan Estes
Compress and encode a string to save loading time in the browser

Latest Articles

by Jeff Dabulis
In this tip, you will learn how to transfer that sample code from your home computer to your locked-down computer.
by Habibur Rony
This article mainly focuses on the CQRS pattern. How we can implement CQRS Pattern using the MediatR. How we can use CQRS pattern with ASP.NET MVC Core and Vue.Js.
by Tomas Takac
Sortable and file-name friendly Base64 encoding
by NikStar
Regex-based solution for decoding values of email addresses fields ("From", "To") and value of "Subject" field

All Articles

Sort by Score

Base64 

23 Mar 2016 by Sascha Lefèvre
It doesn't matter if it's a video or audio or any other sort of file or byte-array. The input for base64 is a byte-array and it doesn't care for the semantic content.There are several articles here on CodeProject presenting base64-encoding and -decoding, take a look: Search - CodeProject[^]
6 May 2015 by CPallini
The problem is in System.Text.Encoding.ASCII.GetBytes usage over a not ASCII value, namely 202 becomes 63.It is worth nothing you don't need all that stuff.string s = System.Convert.ToBase64String(new byte [] { 10, 202, 3 });is just enough.
4 Aug 2017 by Jameel VM
Use _sanitizer.bypassSecurityTrustUrl to tell angular src value is safe You can change your code like below. Import DomSanitizer import { DomSanitizer } from '@angular/platform-browser'; Inject this dependency in to the contructor constructor(private domSanitizer: DomSanitizer) { } ...
31 Dec 2021 by l o o l
Well, in theory, what you need to do would be: 1) get the decoded strings of a pre-existing string present in a given file 2) save this string/line obtained from the file in a variable 3) generate variable substring using space as delimiter,...
26 Jun 2012 by OriginalGriff
Base 64 is not restricted to the hex digits - it includes upper and lower case A-Z 0-9 and (normally) '+' and '/'Base 64 is a superset of base 36, which includes only upper case A-Z 0-9I think you are confused between Hexadecimal and base 64. Check your implementation.Using Base 36 to...
19 Mar 2013 by Zoltán Zörgő
If you want to send images over network and you don't want TCP because of it's overhead or other limitations, you can use of course UDP. But: UDP is not reliable, and as you noticed, you might encounter several problems if you want to send large files (that need to remain consistent)....
21 Apr 2015 by Sergey Alexandrovich Kryukov
What make you thinking that the e-mail is encrypted? Hardly. If this is base64, it has nothing to do with "encryption".This is how you can work with it: https://msdn.microsoft.com/en-us/library/system.convert.frombase64string%28v=vs.110%29.aspx[^],see other base64 methods:...
26 Jul 2015 by OriginalGriff
Base64 is trivial - which is why you should not be using it!https://msdn.microsoft.com/en-us/library/system.convert.tobase64string(v=vs.110).aspx[^]https://msdn.microsoft.com/en-us/library/system.convert.frombase64string(v=vs.110).aspx[^]It is not an encryption method, it is a...
2 Feb 2016 by John Jiyang Hou
A Base62 encoding algorithm with a special prefixed code for utilizing Base64 schema in Java
27 Apr 2016 by OriginalGriff
The problem is twofold: firstly as CHill60 has pointed out, you have a redundant inner loop:foreach (DataGridViewRow row in dgvProducts.Rows){ byte[] imageBytes = Convert.FromBase64String(row.Cells["Picture"].Value.ToString()); using (MemoryStream ms = new...
13 Jun 2016 by OriginalGriff
"I'am stuck at the part where the newly created file is converted to a base64String. Previously i created an application that took a hardcoded file and turned it into a base64String. im trying to to the same but with any file now."All you have to do is replace the hardcoded path with the...
12 Oct 2017 by Richard MacCutchan
A QR code string is just a sequence of bytes, like anything else in memory. So what exactly is your problem?
21 Aug 2020 by Jeff Dabulis
In this tip, you will learn how to transfer that sample code from your home computer to your locked-down computer.
8 Oct 2020 by OriginalGriff
We can't see the data but it depends on three things First, the format of BMP files, which may not be what you expect: BMP file format - Wikipedia[^] - it can contain a whole load more than just the pixel data, and all of that is are the "front"...
3 Nov 2020 by Richard Deeming
Try prefixing your UNC path with two forward slashes: $targer_dir = "//192.168.232.199/xampp/htdoc/training/uploads/image/images/".$nama.".jpeg"; NB: You will need to validate the $nama variable to ensure that it doesn't contain any invalid...
3 Apr 2012 by WebBiscuit
Base64 Encoder and Boost
19 Mar 2013 by Dave Kreskowiak
You can turn a bitmap into an array of bytes with this: ' You can use your own bitmap object. This one is just for illustration. Dim myBitmap As New Bitmap(1280, 1024, PixelFormat.Format32bppArgb) ' Create a Rectangle object the size of the entire bitmap. ...
10 Jul 2013 by Sergey Alexandrovich Kryukov
Here: http://msdn.microsoft.com/en-us/library/system.convert.aspx[^].Look for *Base64* methods of this class.—SA
12 Jul 2013 by azeeth
Hi I have a need to deserialize an XML file which contains an image in base64 string. When I deserialize the XML the image is straight away populated as bytes by the following class. Which pretty much eliminates the need to do anything fancy and I write the image from those bytes. However a few...
14 Jul 2013 by GauravThorat
Hi,I am using webservice, which is taking Base64 as input and Converting this base64string to byte array and then finally saving mp4(for e.g) to disk.Now am trying to play this mp4 file but it is not able to play, where as my original file is working.[ScriptMethod(ResponseFormat =...
14 Jul 2013 by OriginalGriff
I tried your code, and it works ok - once I'd deleted the retResult variable you don't use (I run with "Treat Warnings as Errors" so it wouldn't compile with it in)I would suspect that you need to look at the base64 data you are passing to the method - it is probably not correct if your file...
14 Jul 2013 by GauravThorat
Hi All,I have found the reason, why it was not working, After Searching, I have used the following code which is used to write the Base64String, which i used to pass my method, (Previously I have used Base64EncoderDecoder Software to get base64 string), So I just passed the Input which...
16 Jul 2013 by GauravThorat
Hi All,I wanted to get File type (File Extension) from Base64String in ASP.NETI have web method in which I have passed 1) Base64 string and 2) File Name with File Extensionbut now I wanted to Pass 1) Base64 String and 2) Only File Name (Without Extension)So Can I get that Extension...
16 Jul 2013 by OriginalGriff
Unless the extension is contained within the data converted to base64, then no, you probably can't.It may be possible to look at the data and decide if it is one of a small range of types, but that will depend on the types that you are checking for, and their individual data formats.There...
10 Oct 2013 by Morgan Estes
Compress and encode a string to save loading time in the browser
11 Oct 2013 by ASP.NET Community
View state is where the status of the page is saved when it is submitted to the server. View state is saved as hidden controls, within the form. View
17 Jun 2014 by Uriel Tinashe Patsanza
Still A Newbie. I would like to replace the long Base64 string with a variable but keep getting error: Index was outside the bounds of the array.Scenario: I am retrieving the full base64 string from SQL database e.g...
17 Jun 2014 by OriginalGriff
Check your data in the DB: almost certainly you have saved it wrong.If I try your code:String ClientSigImg;String ClientSigImg1;ClientSigImg = @"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";ClientSigImg1 = ClientSigImg.Split(',')[1];string base64...
23 Jun 2014 by rickolous
Hey guys, I am trying to solve one of the problems in the authentication section of pentesterlabs but I just can't seem to get it right. In essence, I am trying to use the urllib2 library in python for basic HTTP authentication, however despite providing the correct username and password I keep...
5 Jan 2015 by Velkumar Kannan
How to add image data in json.???I have converted the image data in to Base64 string and i have to add this base64 string in JSon..
6 Jan 2015 by Arjsrya
Create a class with required properties like Image Id,Image etc.Store the values in those prooperties and convert it into JSON using Newtonsoft Library.You can serialize it into json object as follows.ImageProperties image = new ImageProperties();image.ImageId=101;image.ImageData =...
13 Jan 2015 by Member 11368467
I have created an decryption script, and it complies without throwing any errors although it returns a junk string with strange symbols. An example of encrypted string: fff: T3UZSkX4vsJxnWEaIMWK3w==When decoded: ￯ᄒヨ5p￯﾿チ￯ᄒミ￯ᄒワ￯ᄒᆰ`￯ᄒᄆ,Ch￯﾿ホ￯﾿ᄌ￯﾿ᄂThe part of script I am using to decrypt...
5 Mar 2015 by Aditya_Goud
I have taken a button and selected an image using PhotoChooserTask ..then i displayed its file name on a button .. now i need to convert that image into base64 and display that base64 value in a textbox.. i dont know how to convert .. Any help will be appreciated void...
5 Mar 2015 by Aditya_Goud
Heyy .. Found it my self.. Posting the sol here for further developers to know.. Here is the complete solution for selecting image from gallery using Photochoosertask ,converting that to byte and then byte to base64 string public void photoChooserTask_Completed(object sender,...
9 Mar 2015 by Mdzzzl5
Either you key, or the encodings of the data and/or string. Are you sure the default encodings for your Ruby installation match the charset of the database?http://ruby-doc.org/core-2.2.1/Encoding.html[^]
29 Mar 2015 by Praneet Nadkar
Hi,I think your base 64 string is incorrect. How did you convert it to base 64 ? You can validate your Base 64 string like this:public bool IsBase64String(string s){ s = s.Trim(); return (s.Length % 4 == 0) && Regex.IsMatch(s, @"^[a-zA-Z0-9\+/]*={0,3}$",...
15 Apr 2015 by TAREK BAZINGA
I am writing a c++ program that should send some mails using SMTP. I need to send the server the AUTH PLAIN request, so I need to code my "\0user@domain.com\0password" to base64, so that I can send the full request. When I pass the "\0user@domain.com\0password" to any program that decodes to...
15 Apr 2015 by CPallini
You should use the std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) function to encode your (binary) string.
16 Apr 2015 by Orjan Westin
Where are you getting the in_len parameter? If you get it from strlen(bytes_to_encode) you will get zero length, since that counts up to the first null character.If you are sure the string is correctly formatted, you need to find the position of the third null, which indicates the end of the...
6 May 2015 by Member 11266633
What i make wrong? $massiv = [10,202,3];$massiv = array_map("chr",$massiv);$rezult= implode('',$massiv);$temp = base64_encode($rezult);echo $temprezult --> CsoD List lst = new List(){10,202,3}; var rez = string.Join("",lst.Select(x =>...
23 Jul 2015 by Member 11858501
I'm using AngularJS and the gmap module to add markers using a REST API, struggling with the marker icons. i have a JSON data structure that contains the icon as base64{ "info": { "off_icon_type": null, "idle_icon": null, "description": null, ...
26 Jul 2015 by SM Mustafa
Dear Friends...!Please tell me how to encode and decode the passwords containing "==" like 1234 : WxisdfO/d02+U9YQKrQXpQ==Abcd : hFQ/PN6UphWhW/X+g==Abc@123 : U+suc1lQEmwmjxR/LqXtEQ==Thanks
25 Jan 2016 by JuanFelipe Loyola Andrade
Hello, I have a server connected to a GoPro camera, which sends the images in base64 format, and can be seen on localhost, now I need to capture screenshot, but I can not, any ideas? Go Pro cliente
10 Mar 2016 by LC Garcia Rocha
I need to insert an image in Reporting Services, but that image has to be in line with text containing my report, I am working with a table that tends to grow to the right, the image has to be placed at the right end of my report, it is the bigger say to the right the image has to be placed at...
29 Mar 2016 by Mr. Mahesh Patel
Use xml serialization and deserialization.by using it you can convert object of your class in xml. and in your object of class you can set value.
27 Apr 2016 by BEBE2011
Hi,What im trying to do is display an image on a datagridview that has been converted from a base64String.My problem is it is displaying the same image for each row even though the base64String for each image is different. My code below shows that i have declared the ImageColumn first, then...
19 Sep 2016 by H.AL
I have asked this question before but I got no answer. I am trying to get blob data from oracle and read it, than converting my Byte Array to base 64 so I can display later my image in my web page. But the problem is that my blobs are so huge, each array byte length is more than 1 500 000, so...
19 Sep 2016 by OriginalGriff
It works for me:Dim rawData As Byte() = File.ReadAllBytes("D:\Test Data\BigImage.jpg")Dim base64 As String = Convert.ToBase64String(rawData)Console.WriteLine("{0}:{1}", rawData.Length, base64.Length)Gives me:3489676:4652904Which is an input image data file twice the size of the ones...
10 Apr 2017 by OriginalGriff
Your string is not a valid Base64 string: it's length is wrong at 37 bytes, and I don't believe in the least that a minimal Winforms app will come in at under 7.5K of binary, so I'd be looking for a Base64 string of around 10K. At a guess, you copy and pasted it badly - check your code that...
27 May 2017 by Dave Kreskowiak
Why on earth are you using VB6 in this day and age? It's been dead and outdated for quite a long time now. You're probably going to have to write your own implementation. See this[^] for various implementations you might use as a starting point.
23 Mar 2018 by Manidas Payyoli
Quote: want to encode the uploaded files to base64 so that I can pass them to the request. The problem is that I'm using Angular 2 with Typescript and I couldn't find any info on how to do that. I found that in Javascript it can be done with canvas but I don't know how could I implement the...
27 Jul 2017 by Manidas Payyoli
I want to send uploaded files to base64 so that I can pass to the request(I am using Remote API's). The problem is that I'm using Angular 2 with Typescript and I couldn't find any info on how to do that. I found that in Javascript it can be done with canvas . What I have tried: I have...
25 Oct 2017 by Richard MacCutchan
See java.security (Java Platform SE 8 )[^]. Don't know angular.
27 Oct 2017 by Member 13489122
I gets an error due to can't get the value of textbox below: ADODB.Stream error '800a0bb9' Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. My HTML Codes
27 Oct 2017 by /randz
The maximum POST size depends on web server and web browser. I have a feeling that the the Base64 sample on your post is partial and probably large. Since this is post under ASP classic, check AspMaxRequestEntityAllowed setting of your web server. That should give you some ideas.
23 Mar 2018 by Cool Webpro
getFiles(event) { this.files = event.target.files; var reader = new FileReader(); reader.onload = this._handleReaderLoaded.bind(this); ...
6 Jun 2018 by rikidev
Hi guys I have to view a pdf in base64 in a WebView to do so I used the code below but it does not work! How can I visualize it? I tried this solution but it does not seem to work, nothing is shown in the WebView! What can it be? What I have tried: @Override public...
6 Jun 2018 by Jochen Arndt
WebView does not support showing PDF files (besides using external services like the Google Docs viewer which requires an URL to the PDF file). You have to choose another method. Just search the web for something like "android show pdf".
16 Jul 2019 by Member 13605567
Hello guys I successfully found a method that claims to make a file input file into a base 64 string in JavaScript so I successfully sent that base 64 string by JSON via AJAX and the base 64 encoded string looks like this sent in the JSON method...
13 Jul 2019 by MadMyche
You are setting the wrong content-type in javascript; whenever their is a file attachment you should be using contentType: 'multipart/form-data'
16 Jul 2019 by Richard Deeming
Assuming you're using PHP 5.2.0 or later, this suggestion from StackOverflow[^] applies - PHP supports reading the content of data: URIs directly: $photo = $upload_info_json_object->photo; $path= $_SERVER['DOCUMENT_ROOT'].'/send-json-data-by-ajax/object-based/with-file/2/images/image.jpg';...
27 Oct 2019 by Luc Pattyn
Hoping that your data is real XML (including lots of characters which were not visible in your question) you should look at standard deserialization. This site holds good articles, and has a search facility; which would yield stuff like this: XML Serialization and Deserialization: Part...
10 Sep 2020 by Gerry Schmitz
Doesn't look like you even attempted a (PHP) base64_encode. PHP: base64_encode - Manual[^]
10 Sep 2020 by Richard Deeming
URL.createObjectURL() - Web APIs | MDN[^]: The URL lifetime is tied to the document in the window on which it was created. You cannot access a blob: URL from the server. You can only access it via Javascript.
13 Sep 2020 by oronsultan
Hi, I'm looking for a way in c# to convert base64 png to base64 jpg. I'm extracting the data from the data-base and my api needs to return the base64 in jpg format without saving the file during the conversion. Thanks. What I have tried: I've...
13 Sep 2020 by Patrice T
Quote: Convert base64 png image to base64 jpg image without saving Procedure: - Get base64 stream - Convert back to normal png format - Convert to jpg - Convert to base64 Quote: I've trued to return the thumbnail of the original image but the...
13 Sep 2020 by User 11060979
This should help you private byte[] Base64Png2Jpeg(string base64) { byte[] jpgArray; Byte[] pngBytes = Convert.FromBase64String(base64); using (MemoryStream msPng = new MemoryStream(pngBytes)) { using (Image img =...
13 Sep 2020 by OriginalGriff
Read the Base64 data into an Image class instance viaq a stream Save the Image as a JPG into a Stream, and convert that to Base64. private string FromBase64PNGToBase64JPG(string base64PNG) { byte[] bytes =...
2 Nov 2020 by OriginalGriff
Firstly, your naming conventions leave a lot to be desired: "imagetoString" accepts an image, but it doesn't return a string, and it actually tries to write it to a file rather then do anything with a string. Make your method names reflect what...
3 Nov 2020 by Komang Putra
excuse me guys, i wanna ask.. example :
31 Mar 2021 by Chopin2001
Read binary file, encode it as base64 data and put this in json. Display base64 in console.log (data.src) of readBinary function. However, there is no src member in the resData JSON after calling the function. How can I solve this? What I have...
6 May 2021 by Varun Sareen
Hello, I am trying to send the image converted into byte data (base64) to ajax method so that the value of the same will be available at server side for me to save the image value in DB. But I am unable to achieve the same. Please help. What...
9 Jun 2021 by shiva_yn
I have base64 formatted string. I want to display that base64 string into image in WPF. I tried the below code. but after run this code no errors. but image not shown. please give me a solution for this problem. What I have tried: xaml ...
9 Jun 2021 by Richard Deeming
Check the output window in Visual Studio for runtime data binding errors. There are two problems with the code you've shown: 1) You've declared the ImgSource variable as either a local variable, or a field. WPF binding only works with...
11 Jul 2021 by Faran Saleem
I am trying to select an image using an input tag from JavaScript, however I am getting undefined error. Please see my code below, I am getting error at input.files[0] How can I select an image? function loadImage(input) { var file =...
10 Aug 2021 by pcprogrammer9
I'm pretty new to Xamarin , i want to change image source after clicking a button , using FromStream method and base64 string , but after run application no image showing , here is my code : note : i test my Base64 String on online convertor and...
9 Nov 2021 by Richard MacCutchan
The image is just an array of bytes, so follow one of the encoding suggestions at base64 in C++ - Google Search[^]
23 Jun 2023 by Manidas Payyoli
i am binding a base64 image to the UI.which is in a loop.but image is not binding,while inspect element i can c the image but not rendering Db is not returning data:image/jpg;base64, so i added in html while inspect elenment im getting "data:image/jpeg;base64,/9j/4A but it is not...
23 Jun 2023 by Member 16036583
//Yes, /9j/4A decodes to the JPEG header ÿØÿà, but the rest of the binary data in the Base64 string is likely different. When a browser decodes the Base64 image data URL, it is expecting a proper JPEG image format with a valid header and no...
15 Mar 2020 by Habibur Rony
This article mainly focuses on the CQRS pattern. How we can implement CQRS Pattern using the MediatR. How we can use CQRS pattern with ASP.NET MVC Core and Vue.Js.
19 Mar 2013 by Dave Kreskowiak
Why are you converting an image to Base64 in the first place?? Surely it can't be to think you'll get less data to send?? You're actually making MORE data to send, not less by doing this conversion. A screenshot at 1280x1024 results in just over 5.12MB of data. The Base64 string of this data...
3 Nov 2019 by Tomas Takac
Sortable and file-name friendly Base64 encoding
26 Jun 2012 by Stephen Hewison
Hi,Does anyone have code for converting from base 64 to base 36 and back?base 64 character set is 0123456789ABCDEFbase 36 character set is 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZThis is needed as I can't represent the data I'm trying to display in the room I have to display it, it has...
23 Mar 2016 by Sergey Alexandrovich Kryukov
This is not really a "conversion" — please see Solution 1. It's here:Convert.ToBase64String Method (Byte[]) (System)[^],Convert.FromBase64String Method (String) (System)[^].However, the whole idea looks quite questionable.—SA
18 Mar 2013 by Prasad Khandekar
Hello,How about using System.IO.Compression.GZipStream class. The example of using this class can be found here[^] in MSDN library. There is one more example available here[^].Regards,
2 Aug 2017 by NikStar
Regex-based solution for decoding values of email addresses fields ("From", "To") and value of "Subject" field
7 Jun 2021 by orgilhp
I have a base64 string which is provided below. I guess its type is Application/Octet-stream.I am using code below to convert it to an image. But it gives me error "Paramter is not valid!".string base64string = "AAAAAQEAAAEcEgABHxIA ... xYAAF4WQABcFwAAQ==";using (MemoryStream ms = new...
31 Dec 2021 by Member 14933392
I have been trying to make my own base in batch, and I use base64 at the same time. I already have a system setup that will transfer it from base64 to decimal, and I have it like this: ...
23 Mar 2016 by Member 12301708
i wanted to convert a video file into base64 to get it in xml formatWhat I have tried:var bytes[] = File.ReadAllBytes("filepath");
21 Apr 2015 by oronsultan
hey guys,about a year ago i developed a program to my comapny that extract customers call from our website, decrypt it and pushed it to our internel software and from ther to the support department.here the problem: during the last week, my basic assumption is that our server did some...
18 Mar 2013 by Rixterz123
Hey againI have made a program that turns an image into a base64 string and sends via UDP.the problem is that i get an error when the base64 is too largeHow do you compress this on the host side and then decompress back into a base64 string on the client side?Help is appreciated.
27 Oct 2019 by CDCC8
Hi everyone,I'm trying to represent a ECG signal contained in a Xml File. I'm wondering what's the best way to do that?Seems that the signal of all channels are encoding in base64, so i've got to decode it into readable values, to represent the graph.Here's a piece of the Xml...
10 Jul 2013 by CDCC8
Hi everyone,I have a file with a Base64 string that i have to decode into numbers, and i don't know how to do this in C#.I know how to convert to binary,using Convert.FromBase64String. However i've got to obtain numbers like coordenates X/Y to plot this into a graph, because this is a...
29 Mar 2016 by Member 12301708
i tried to pass the value to xml file but it gives me error "Invalid URI: The Uri string is too long"What I have tried:byte[] videobytes = File.ReadAllBytes("C:test.wmv"); string result = System.Convert.ToBase64String(videobytes); // Create...
13 Jun 2016 by BEBE2011
Hi im trying to convert a file to a base64String and then store that string in a text file. What i am trying to create is a Windows Service - As soon as a file is created in a certain folder.The Service creates a Log file to say that a file has been added to the folder put then it should...
10 Apr 2017 by evilcode1
i still get this error when i try to debug the project i dont know why ... Quote: 'WindowsApplication13.vshost.exe' (CLR v4.0.30319: WindowsApplication13.vshost.exe): Loaded 'c:\users\evilcode1\documents\visual studio...
28 Jul 2017 by UMDC
I made my own Base32/64 Ecoder/Decoder...
12 Oct 2017 by GaneshRfromSpace
I want to generate a QR Code image using JAVA. Its a legacy project so the target version of java is 1.3. Can I programatically convert a QR Code string to base 64 string or a byte array and then convert into image through java itself ? What I have tried: I have been converting base 64 strings...
25 Oct 2017 by User_K2
Am trying the following in c# and its working, /*creating base64 encoded signature in C#*/ var secret = "#asecret#"; var message = "Thu, 26 Oct 2017 06:41:08 GMT/myaccount/mymessage"; using (var hmac = new HMACSHA256()) { hmac.Key = Convert.FromBase64String(secret); byte[] sigbyte...