Short answer: They are two valid spellings of the exact same word, but "cipher" is more common than "cypher".

Long answer:

I just came across [this page][1], which is entitled ***It’s Cipher, Not Cypher***. It says:

> ### Where did the variants [of cipher] come from?
> 
> The word we know today as cipher originated in the late 14th century
> from the Arabic word _sifr_, meaning “zero.” At this point in the
> English language (Middle English) the spellings of words were not yet
> explicitly defined, and writers commonly substituted _i_‘s for _y_‘s
> at will, hence the emergence of cypher as a variant for cipher.
> 
> However, after the Great Vowel shift and the standardization of
> spelling in the 15th and 16th centuries, many of the y’s that denoted
> “eye” sounds in English were replaced by i’s–hence the change of “wyf”
> to “wife,” and “cypher” to “cipher.”
> 
> ![enter image description here][2]
> 
> Even so, cypher is still considered a valid variant of cipher in many
> orthographic circles today. Cypher is most popular in England, where
> it first emerged.

---

Additionally, [this graph][3] from [Peter Shor's comment][4] shows how "cypher" was the preferred word until the early 19th century, when "cipher" became more popular. [This page][5] shows that almost every country nowadays uses "cipher" over "cypher", with the exceptions being Ghana and Nigeria (and that's probably just from a lack of enough data).


  [1]: http://blog.cipherprime.com/uncategorized/2013/05/its-cipher-prime-not-cypher-prime/
  [2]: https://i.sstatic.net/3hshl.jpg
  [3]: https://books.google.com/ngrams/graph?content=cipher,cypher&year_start=1700&year_end=2000&corpus=15&smoothing=3&share=&direct_url=t1;,cipher;,c0;.t1;,cypher;,c0
  [4]: https://english.stackexchange.com/questions/147965/cypher-vs-cipher#comment305270_147966
  [5]: http://www.google.com/trends/explore#q=cipher,%20cypher&cmpt=q