iPhone SDK base64 encode / decode

I found this useful class for base64 encoding / decoding. It is written by Kiichi Takeuchi


@interface Base64 : NSObject {

+ (void) initialize;
+ (NSString*) encode:(const uint8_t*) input length:(NSInteger) length;
+ (NSString*) encode:(NSData*) rawBytes;
+ (NSData*) decode:(const char*) string length:(NSInteger) inputLength;
+ (NSData*) decode:(NSString*) string;


Sample Usage

[Base64 initialize];
NSData * data = [Base64 decode:@"SGVsbG8gV29ybGQ="];
NSString * actualString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
[actualString release];

Download base64 encode / decode class

By Imthiaz

Programmer, SAAS, CMS & CRM framework designer, Love Linux & Apple products, Currently addicted to mobile development & working @bluebeetle


  1. If you want to get the best SEO in Dubai or anywhere else you have to make sure that the company knows both how to search engine optimize your website and how to do quality manual linkbuilding.

Comments are closed.